Rick,
This is what I do:
- Code: Select all Expand view
LOCAL hInitData := { => }
// Lets decode the response
hb_JsonDecode( cResponse, @hInitData )
cReply := HB_HGET( hInitData, "sid") // Message id
The LOCAL gives me a hash.
cResponse contains the JSON code. Using that function, the Json is transferred to the hash
"sid" is the identifier for the data I want. HB_HGET( ) searches the hash for that identifier and returns it's value.
You can use as many identifiers as you want, and as many HB_HGET's to get their values.
Saving them into a variable allows you to use the value, or you can write it to a DBF.
If you don't know the identifiers, just do an XBROWSE( ) on the hash file. The first column will be the identifier, and the second column the value. When you receive the Json responses, those identifiers will be
consistent, so you can grab just the ones you want out of each reply. Of course, make sure you initialize the variables first to empty values so if nothing is returned, you won't have an error.
I hope this helps. In fact, I just did this yesterday when setting up the log system for text messages, and their replies.