zcl_mdp_json icon indicating copy to clipboard operation
zcl_mdp_json copied to clipboard

Raise exception in DESERIALIZE_OBJECT

Open Teddynet opened this issue 6 years ago • 4 comments

Hi, when I try to deserialize a json string, I receive a "raise exception" on method DESERIALIZE_OBJECT at line 35 when it try to find regex '\A\s*"([^:]*)"\s*:' My json seems to be well formed (I tried to validate it with several online validators), I'm attaching it to the message. Thanks example.json.txt

Teddynet avatar Sep 27 '18 09:09 Teddynet

Hi, the problem is in the last node "properties" where both keys name contains char : . A possible solution is to use this regex \A\s*"([a-zA-Z0-9:_]*)"\s*: in order to accept also char : in the key name. In this way deserializer works succesfully. Let me know.

Teddynet avatar Sep 27 '18 10:09 Teddynet

Hi Teddynet, thank you for the issue report and the proposed solution. I will look into the issue and update the repo. Regards, Fatih

fatihpense avatar Sep 27 '18 12:09 fatihpense

I face the same issue when a JSON key contains multiple ":" like "urn:eim:linkrel:session".

josefgruber1 avatar Jan 09 '19 14:01 josefgruber1

The issue with multiple ":" was solved by the updated regular expression from @Teddynet. I faced another issue with a "-" in the JSON key. With this regular expression everything is working now as expected: \A\s*"([a-zA-Z0-9:_-]*)"\s*:

josefgruber1 avatar Jan 09 '19 15:01 josefgruber1