#1 2014-02-20 13:34:35

chapa
Member
Registered: 2012-04-30
Posts: 117

DynArrayLoadJSON

Hi ab,

Very happy with new record <-> json functionality.
Trying to DynArrayLoadJSON valid JSON string I get wrong/no result.

Figured out, that if I delete all #13 #10 #9 chars from source json string everything goes correct.
It is in case where I have array of record inside array of record.

Offline

#2 2014-02-20 13:43:52

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,570
Website

Re: DynArrayLoadJSON

Do you have code to reproduce the problem, please?

I'm a bit lost here...
Code is supposed (and tested) to work with no problem for JSON content using any characters within [#1..' '] range.

Online

#3 2014-02-20 14:57:32

chapa
Member
Registered: 2012-04-30
Posts: 117

Re: DynArrayLoadJSON

Forgot to mention, it happens when soReadIgnoreUnknownFields is set and not all property names are defined in the descriptor constant string.
Maybe this will lead you to some ideas.
Will email example tomorrow.
Thanks.

Offline

#4 2014-02-20 15:44:15

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,570
Website

Re: DynArrayLoadJSON

Trying with:

  Parser.Options := [soReadIgnoreUnknownFields];
  U := '{ "A" : 1 , "B" : 2 , "C" : 3 , "D" : "A" , "tobeignored":null,"E": '#13#10+
    '{ "E1" : 4, "E2" : 5 } , "tbi" : { "b" : 0 } }';
  RecordLoadJSON(JR2,@U[1],TypeInfo(TTestCustomJSONRecord));

I was able to reproduce the issue.

Should be fixed by http://synopse.info/fossil/info/0f8cd9c9a0

Thanks for the feedback!

Online

#5 2014-02-20 19:37:01

chapa
Member
Registered: 2012-04-30
Posts: 117

Re: DynArrayLoadJSON

Thanks ab,
Yes, source json looks like the one you typed, with many spaces and #10 #13.
Will test it tomorrow over my source json and let you know results.
Thanks once again.

Offline

#6 2014-02-21 06:59:44

chapa
Member
Registered: 2012-04-30
Posts: 117

Re: DynArrayLoadJSON

I confirm the fix works in my case smile thanks

Offline

Board footer

Powered by FluxBB