Media_JSONPath ( json; jsonPathExpression )
The Media_JSONPath function allows you to extract values from a JSON structured document using a JSONPath query language, including filtering.
Parameter | Description |
---|---|
json |
a JSON document to parse values from. |
jsonPathExpression | a JSONPath expression describing which values to extract. Look at https://jsonpath.com/ for JSON Path description and a testbed. |
Suppose the JSON returned by Media_GetMetadata( container; ""; 2 ) is:
[
{
"frameID": "TCOM",
"frameName": "Composer",
"text": "Traditional"
},
{
"frameID": "TCON",
"frameName": "Genre",
"text": "Medieval/Instrumental"
},
{
"description": "",
"frameID": "COMM",
"frameName": "Comments",
"language": "",
"text": "Change this metadata tag..."
},
{
"frameID": "TIT2",
"frameName": "Track Title",
"text": "Riu Renamed"
}
]
You can use, for example, the following values for the jsonPathExpression parameter:
To get a list of all frame codes
Set Field [ MyTable::Result ;
Media_JSONPath (
aboveJSON ;
"$..frameID"
) ]
["TCOM","TCON","COMM","TIT2"]
To get the Composer frame’s value using a filtering expression
Set Field [ MyTable::Result ;
Media_JSONPath (
aboveJSON ;
"$[?(@.frameID=="TCOM")].text"
) ]
["Traditional"]