suggestion on parsing this JSON access its values?

0 favourites
  • 14 posts
  • would like to know some method to read in this JSON from URL and then access each its key/value. looking for tutorial or sample code. thanks!

    [{"id":"42","pct":"69th","phone":"17182576211","fax":"","email":"","address":"9720 Foster Avenue","lat":"40.6484","lng":"-73.9049","borough":"queens","city":"nyc","state":"ny","distance":"0.5231590272587"},{"id":"38","precinct":"63rd Pct","phone":"17182584412","fax":"","email":"","address":"1844 Brooklyn Avenue","lat":"40.6281","lng":"-73.9414","borough":"queens","city":"jersey city","state":"ny","distance":"1.854571460077"}]

  • i really appreciate it. is this a certain solution?

    the JSON is flat, so looking to just accessing key/value. thanks.

    or anyone else have a straight answer on this QUES. thanks again.

  • mindfaQ, is your suggestion of a solution a two-step or like a two-plugin solution?

    No clear answer and description. so please clarify.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • mindfaQ, i installed rex_csv.7z

    i IDE programmed it to load AJAX.LastData containing the JSON above.

    So its like CSV.At(key, 0) like that to get value? or is there another step or plugin to drive more people crazy?

  • JSON parsing is a wild goose chase w. no straight answers in C2 haha!

  • Have you spent any time at all reading the manual or looking at the example and tutorials?

    Or is it that you just expect everyone else to do everything for you, and if you don't receive a satisfactory answer after half an hour, start slagging everyone and everything?

    Wow.

  • read a lot of stuff and get no straight anwsers and stuff like yours haha

  • Not sure why you install rex_csv when I linked rex_hash. Also I did not work with it yet, so the only thing I know is that it seems to be able to parse json files that are not specially formated for c2.

  • exactly my point before.

  • There is no json plugin. One option is making your data match the format os some plugin's .toJSON expression then loading that back into the plugin. You can also use the "execute javascript" action and expressions of the browser object.

    Here's a starting point:

    https://dl.dropboxusercontent.com/u/5426011/examples20/json_parse.capx

    It's then your responsibility to make sure you have inputted everything correctly otherwise you will get errors.

    Refer to this tutorial for more info:

    http://www.w3schools.com/json/json_eval.asp

  • yeah, sure, but moving to another product. haha

  • Haha indeed...

    Anyway I wish you luck. A program with more stock gui manipulation may be helpful for your case. If you don't mind diving into coding I hear c# has nice gui capabilities and good gui designer to boot. C2 could likely do the kinds of programs you had in mind but as you may have noticed you'd have to make most of the gui stuff from scratch. Which isn't too bad since it gives you finer control of what it does.

  • the problem is, JSON is like so part of the internet, yet c2 developers doesn't get it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)