JSON - ExtractJSONList()

Just starting out? Need help? Post your questions and find answers here.
User avatar
Arbrakaan
Posts: 91
Joined: Mon Feb 24, 2014 10:54 pm
Location: Geneva
Contact:

JSON - ExtractJSONList()

Post by Arbrakaan »

Hello all,

I don't understand why this show noting in the debugger.

Code: Select all

Input$ = "[{'id':'0','name':'Daniel'},{'id':'1','name':'Pierre'},{'id':'2','name':'Jean'}]"
  
  Structure Location
    id.s
    name.s
  EndStructure
  
  NewList Locations.Location()
  
  ParseJSON(0, Input$)
 
  ExtractJSONList(JSONValue(0), Locations())
  
  ForEach Locations()
    Debug Locations()\id + ", " + Locations()\name
  Next
  
I took the same structure of code as in the SpiderBasic exemple : ExtractJSONList()

Code: Select all

  Input$ = "[ {" + Chr(34) + "x" + Chr(34) + ": 10, " + Chr(34) + "y" + Chr(34) + ": 20}, " + 
             "{" + Chr(34) + "x" + Chr(34) + ": 30, " + Chr(34) + "y" + Chr(34) + ": 50}, " + 
             "{" + Chr(34) + "x" + Chr(34) + ": -5, " + Chr(34) + "y" + Chr(34) + ": 100} ]"
  
  Structure Location
    x.l
    y.l
  EndStructure
  
  NewList Locations.Location()
  
  ParseJSON(0, Input$)
  ExtractJSONList(JSONValue(0), Locations())
  
  ForEach Locations()
    Debug Str(Locations()\x) + ", " + Str(Locations()\y)
  Next


Thanks for the help :)
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: JSON - ExtractJSONList()

Post by Peter »

replace the single quotes with double quotes.

Greetings ... Peter
User avatar
Arbrakaan
Posts: 91
Joined: Mon Feb 24, 2014 10:54 pm
Location: Geneva
Contact:

Re: JSON - ExtractJSONList()

Post by Arbrakaan »

Hurg.... :D

Thanks Peter for the quick answer ;)
Post Reply