It is currently Thu Dec 12, 2019 10:43 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: [JSON] How to remove object
PostPosted: Tue Jun 25, 2019 7:16 pm 
Offline
User
User

Joined: Tue Dec 09, 2014 7:16 pm
Posts: 23
Location: Brasil
I'm testing RemoveJSONElement and RemoveJSONMember not work for my, what remove "lineup" object?

Code:
Define json_text$ = "[{"+Chr(34)+"example"+Chr(34)+":"+Chr(34)+"1"+Chr(34)+","+Chr(34)+"lineup"+Chr(34)+":{"+Chr(34)+"element"+Chr(34)+":"+Chr(34)+"element1"+Chr(34)+"}}]"
ParseJSON(0, json_text$)
If IsJSON(0)
;   RemoveJSONElement(JSONValue(0),1)
;   RemoveJSONMember(JSONValue(0),"lineup")
    Debug ComposeJSON(0)
EndIf


Top
 Profile  
Reply with quote  
 Post subject: Re: [JSON] How to remove object
PostPosted: Tue Jun 25, 2019 8:18 pm 
Offline
Addict
Addict

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 4463
Location: Germany
Hi,

Code:
Define json_text$ = "[{"+Chr(34)+"example"+Chr(34)+":"+Chr(34)+"1"+Chr(34)+","+Chr(34)+"lineup"+Chr(34)+":{"+Chr(34)+"element"+Chr(34)+":"+Chr(34)+"element1"+Chr(34)+"}}]"
ParseJSON(0, json_text$)
If IsJSON(0)
  Debug ComposeJSON(0, #PB_JSON_PrettyPrint)
  ;RemoveJSONElement(JSONValue(0), 0)
  RemoveJSONMember(GetJSONElement(JSONValue(0), 0), "lineup")
  Debug ComposeJSON(0, #PB_JSON_PrettyPrint)
EndIf


you have a json list arround [], so you need to select the element of the list.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: hessu and 20 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye