Mintoris Forum

Author Topic: Janky JSON Parser  (Read 1112 times)

zakerytclarke

  • Sr. Member
  • ****
  • Posts: 195
Janky JSON Parser
« on: Dec 18, 2017, 05:24 PM »
Another user on here requested how to read JSON, so I spent a little time creating a JSON parser. It can't evaluate nested structures, but it extracts all key value pairs into a 2d array. The syntax is as follows:

include "JSON.bas"

dim test$(0)
test$()=json$(json_text_here$)

print test$(0,0) rem the first key
print test$(0,1) rem the first value
« Last Edit: Dec 18, 2017, 05:46 PM by zakerytclarke »

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Re: Janky JSON Parser
« Reply #1 on: Jan 30, 2018, 10:46 PM »
This would be a really good place to use a hash table instead of an array. That would make nested whatevers easy.