[JSON Pretty Format] Formatter fails with single quote character

Forge Component
(8)
Published on 2 Apr by Pedro Domingues
8 votes
Published on 2 Apr by Pedro Domingues

Hi,

Thanks first of all for making this component, it fits our needs perfectly. We have run into a problem however, the formatter fails to show any content when there's a single quote character in the json. Example:

{"Surname":"t'est"}

Is there a possibility to fix this in the near future? Otherwise we'll have to look at another solution.

Thanks in advance!

Ruben

Hi Ruben,

ou need to escape the quotation characters with \:

{"Surname":"t\'est"}

Then it will work.

Regards,

Daniel

Daniël Kuhlmann wrote:

Hi Ruben,

ou need to escape the quotation characters with \:

{"Surname":"t\'est"}

Then it will work.

Regards,

Daniel

Hi Daniël,

Thanks for the fast reply, that is a valid solution. I've tried it and we at least see the json again. There still is a problem however, the single quote is not shown, the json we see:

{"Surname":"test"}

Regards,

Ruben

My mistake.

It is the " (double quote) that you can escape with \"

See: https://www.freeformatter.com/json-escape.html#ad-output

The  ' (single quote) should not be a problem normally.

Regards,

Daniel


Hi again,

Some additional information. The underling JavaScript module used is: https://github.com/abodelot/jquery.json-viewer

If you try our string at the Demo page it does work!

https://rawgit.com/abodelot/jquery.json-viewer/master/demo.html

Hopefully, the component owner will be able to quickly fix it.

Regards,

Daniel


Hi Guys,

First of all, thanks for writing and making this component to be better.

As soon as i can, i will take a look at the reported issue!

Thanks Pedro!

Solution

Hi Guys,

A new version was released with that problem addressed.

Thanks to Bruno Martinho.

Please mark this answer as the solution.

Thanks a lot for your feedback.

Solution

Thanks Pedro and Bruno for the fast solution!

Hi Guys,


Just to let you know that i have uploaded a new version of the component that allows the following:

- Root node to be collapsable;

- Allow Links to be clickable;


Cheers,

Pedro Domingues

Great stuff!

Pedro,

The last two versions don't contain the try catch solution anymore. We use the component multiple times on one page. So when invalid JSON is inserted in one of the blocks, the formatter doesn't show any content for the following blocks. (https://www.outsystems.com/forums/discussion/40961/tool-improvement/)

We've built our own wrapper because sometimes we've got text before or after the JSON we also want to show. We've included try catch in that wrapper but, for other people it might still be a problem.

Regards,

Ruben

Ruben van Vugt wrote:

Pedro,

The last two versions don't contain the try catch solution anymore. We use the component multiple times on one page. So when invalid JSON is inserted in one of the blocks, the formatter doesn't show any content for the following blocks. (https://www.outsystems.com/forums/discussion/40961/tool-improvement/)

We've built our own wrapper because sometimes we've got text before or after the JSON we also want to show. We've included try catch in that wrapper but, for other people it might still be a problem.

Regards,

Ruben


Ruben,

Thanks for your feedback.

This is another topic, completely different from this one.

I kindly ask you, please, to open another topic with that subject and we deal with that subject on another topic.

Is that ok?

Cheers,