What is the simplest way to get only the JSON data which is inputted to a stream?

+1 vote
Is there an API command to display only the data JSON portion of a stream without any other information such as "publishers", "keys", etc...

for example:

"json" : {

"name" : "Jane Smith",

"city" : "Paris"

}

 

If there is not an API command, is there a simple way to do it by creating a node.js file?
asked Jul 17, 2020 by GxFR

1 Answer

+1 vote
There is no direct command to get only the json data, the closest is gettxoutdata which gives the json data only provided you have the txid and vout.

 

Alternatively you can parse the response of liststreamitems or liststreamkeyitems in nodejs to give only the json object, by iterating over the array of response.

e.g

response = response.map(r => r.data.json)

should do the trick.
answered Jul 19, 2020 by DarkBlaze
...