Excuse my English, I am not a native speaker
I have a json file "VideoJson.json" which contains the following
VideoJSONLoaded({"video_type": "0","image_id": "0","profile": false,"published_urls": [{"embed_url": "https://alura.hls/vod/p/manifest/55.mpd","protocol": "https","cdn_name": "Cloud","state": 10,"live_url": "https://alura.hls/vod/p/manifest/55.mpd"}],"access_rules": "{}","timed_cues": [],"embedded_cc": 1,"adst_temp_ver": "2"})
I try to read the json with Xidel with the following command
xidel-0.9.8.x32 "VideoJson.json" -e "$json"
And I get an error message
Error: jerr:JNDY0021: error at VideoJSONLoaded (tkIdentifier) in VideoJSONLoaded...
I think it's because the json is inside VideoJSONLoaded(JSON)
What command should I use to be able to read the json correctly and be able to extract data?
Whatever tool provided you this file did a bad job, because it's not JSON at all.
When you open a '*.json' file,
xidel
assumes JSON (--input-format=json
). If it's not, then you have to override it with--input-format=text
(--input-format=html
for v0.9.8):To extract the JSON you could use
substring-before()
andsubstring-after()
:Or
extract()
:And finally
parse-json()
(json()
for v0.9.8) to parse the JSON: