Json deserialization does not remove escape characters (JSONDataClass)

Tags: #<Tag:0x00007fc0e3525390>

I started using JSONDataClass.FromJSON method to deserialize json-strings to a queue. Unfortunately I see that strings in the resulting queue contain json escape characters - I am getting something like this:
Company \"ABC\" instead of Company "ABC".
Can anyone confirm such a problem? Or am I missing something here? Clarion 11 build 13401.

Hi Andrzej,

Since 11 days have passed since your post, and you’ve had no replies, I guess that’s an implicit “no” to your questions. Don’t take this personally though, as I suspect one of the following replies is in order;

a) It’s like that very few, if any, people are really using the JSONDataClass (there are more popular alternatives)

b) those that are using the JSONDataClass are not experiencing the effect you are seeing.

c) You provided insufficient data in your question. It’s probably helpful if you post all, or part, of the actual JSON file here, as well as your actual code. From that someone may be able to duplicate the issue, or point out where you went wrong.


Hello Bruce,

thanks for your reply!

c) You provided insufficient data in your question (…)

it’s a simple matter - my serialized objects in their properties contain characters (e.g. quotation mark) that must be escaped inside json. Valid json string looks like this:
{"companies":[{"name":"Bar \"Foo\" London","id":1,"city":"London","country":"UK"},{"name":"Pivovar \"Baz\" a.s.","id":2,"city":"Prague","country":"CZ"}]}.

And the problem is that after deserialization with JSONDataClass.FromJSON the “name” field in my queue contains: Bar \"Foo\" London and Pivovar \"Baz\" a.s. while backslash characters should be removed during deserialization.

I suspect you are right about the low popularity of the new classes that have come in recent Clarion releases. They were missing for so long that everyone found alternative solutions.

As I only had a few dozen hours to correct the error I solved it by modifying the AssignANY method in the class.

Best regards,