Quantcast
Channel: Squeezebox : Community : Forums
Viewing all articles
Browse latest Browse all 6235

JSON response can't be parsed as XML

$
0
0
LMS 8.1.0 - Trying to parse JSON respons with JavaScript. Firefox Console report
Quote:

"XML Parsing Error: not well-formed"
I've tried to force response to (text/xml) and even manually loaded the responseText into DOMParser() with the same error.

Wonder if other have similar problem with the JSON repsonse? And possible workaround?

request:
Code:

{"id":1,"method":"slim.request","params":["00:04:20:26:2a:25",["status","-",1,"tags:aulyB"]]}
response:
Code:

{"result":{"digital_volume_control":0,"seq_no":"47","player_connected":1,"can_seek":1,"playlist_cur_index":"5","rate":1,"playlist_timestamp":1611020450.26858,"playlist mode":"off","mode":"stop","playlist_tracks":19,"power":1,"player_name":"Stue Touch","playlist repeat":0,"time":0,"mixer volume":100,"playlist shuffle":0,"player_ip":"192.168.10.51:46056","playlist_loop":[{"artist":"PolyGram","year":"0","id":94136,"album":"1998 - Reklame Klassikere","title":"I Just Want to Make Love to You - Etta Jones","playlist index":5,"url":"file:///srv/dev-disk-by-label-Musikk-HDD/4GBs/wav/Diverse/PolyGram/1998%20-%20Reklame%20Klassikere/06%20-%20I%20Just%20Want%20to%20Make%20Love%20to%20You%20-%20Etta%20Jones.wav"}],"signalstrength":0,"duration":222},"method":"slim.request","params":["00:04:20:26:2a:25",["status","-",1,"tags:aulyB"]],"id":1}

Actual Javascript formated request string used for POST:
Code:

var request = "{\"id\":1,\"method\":\"slim.request\",\"params\":[\"00:04:20:26:2a:25\",[\"status\",\"-\",1,\"tags:aulyB\"]]}";

Viewing all articles
Browse latest Browse all 6235

Trending Articles