JSON Implementation Example?
im a noob when it comes to Json, but want to use it to store my games data, I have a correctly formatted Json file.
But admit have no idea how to implement it in NG, I see it has BRL.Json but it has no examples on how to use it.
Does someone have a simple example file for me on how to load a Json file and apply the data to an object?
Cheers, and Merry Christmas!
Local temp:TJSON, error:TJSONError , file:TStream file = OpenStream:TStream( "incbin::Data/objects.json",True,False) temp.Load:TJSON(file,Null,error) ' Populate object with data using Load Method ' Loop through CloseStream file
Whoa that looks too complicated for me :(
I see. You can also try jannson, this is way more easier.
SuperStrict Framework BaH.Jansson Import BRL.StandardIO Import BRL.TextStream Local text:String = LoadText("menu.json") Local error:TJSONError Local json:TJSON = TJSON.Load(text, 0, error) If Not error Then If TJSONObject(json) Then For Local j:TJSON = EachIn TJSONObject(json) Print j.SaveString(0, 2) Next End If End If
Reply To Topic (minimum 10 characters)
Please log in to reply