NetTalk Central

Author Topic: parsing JSON with jFiles  (Read 3634 times)

AtoB

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • Email
parsing JSON with jFiles
« on: February 24, 2016, 05:38:55 AM »
Hi all,

I've the following json string :

{"FTP" : {"srv" : "test.test.nl","prt" : "","usr" : "username","pwd" : "wachtwoord","pas" : 1}}

which I want to read into the following group structure

FTPGroup                GROUP,PRE(FTP)
srv                       STRING(250)
prt                       STRING(20)
usr                       STRING(250)
pwd                       STRING(250)
pas                       BYTE
                        END


with the following code :

        lSt_JSON.SetValue(CLIP(EMESS:sendto))
        lJSON_FTP.TagCase = jF:CaseLower
        lJSON_FTP.Load(FTPGroup, lSt_JSON, 'FTP')


but the parser somehow treats the "test.test.nl" value as a numeric as it comes up with the following error :

ErrorTrap: "Unexpected literal (.) at position 24 v" : "test.test.nl"

this is the first time I'm using jFiles as a parser, so I might be doing something wrong of course, but I haven't got a clue !

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: parsing JSON with jFiles
« Reply #1 on: March 15, 2016, 06:09:09 AM »
Hi Ton,

done a test here, but it seems to be ok. Which build of jFiles are you using?

cheers
Bruce


AtoB

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • Email
Re: parsing JSON with jFiles
« Reply #2 on: August 02, 2016, 10:54:23 PM »
Hi Bruce,

solved (or actually problem went away!): I was using this in a c6.3 context (which I wasn't aware of aparently, otherwise I would have mentioned or tested it in c10 first ...) and I think I messed up the jFilesLinkMode and jFilesDllMode somehow (although most of the time it results in gpfs ...). Anyway it's working as expected now!

Thanks for looking at it and really sorry for the inconvenience ...

regards,
Ton