Subscribe Bookmark RSS Feed

Parsing JSON data

afterword

Community Trekker

Joined:

Jun 23, 2011

Does anyone know of an existing script or code snippets to get me started on parsing JSON data?  I'm particularly interested in how to handle the process of reading each key:value hash and writing it to the JMP data table.

Here's a sample with a group ID number, followed by the timestamp:reading hashes.

{ "1":[[1341118805, 0.654], [1341205195, 0.654]] , "10037506":[[1341118820.000, 0.900], [1341118880.000, 0.000], ... }


4 REPLIES
afterword

Community Trekker

Joined:

Jun 23, 2011

Never mind - took care of it in Python.

I may work on an R implementation just for ease of passing values between JMP and the parser if the interface with Python proves to be too cumbersome.

pmroz

Super User

Joined:

Jun 23, 2011

The JSON format looks like a list of lists.  You could use the JSL WORDS function for parsing, and an associative array for storage.

afterword

Community Trekker

Joined:

Jun 23, 2011

Good eye!  I'll see if there's a simple way of unpacking it in JSL.  I wanted to avoid reinventing the wheel, but it might be a fun test of my JSL skills, and I'm sure there are others out there who need to parse JSON data.

Thanks for the suggestion!

XanGregg

Staff

Joined:

Jun 23, 2011

I also had a need for getting JSON data into JMP and wrote some parsing functions, which I just uploaded to the File Exchange at JSON Parsing Functions.

(Trying for the record for oldest question answered.)