2011-01-19, 16:30
Montellese Wrote:I'm not sure I understand what you want. The "id" tag should be used to match a response from XBMC to a request you sent yourself. Furthermore if you get a json object without an "id" tag it indicates that you received an announcement and not a response.
If you write your own parser you should basically count the number of { and } to determine the end of a message. And you should use a json library which can read a json object and detect the available fields and their values and not use regular expressions because there are alot of different response objects and I don't think you would want to write regex's for all of them.
Hi Montellese
I want the "id", alot of them! in every { }
like this
Code:
{
"id" : 50,
"jsonrpc" : "2.0",
"result" : {
"end" : 2,
"movies" : [
{
"id" : 50,
"fanart" : "special://masterprofile/Thumbnails/Video/Fanart/a8c81876.tbn",
"file" : "/home/xedar/movietest/Arn.vid.vägens.ände/arnvägen.mkv",
"label" : "Arn - The Kingdom at Road's End",
"movieid" : 1,
"originaltitle" : "Arn - Riket vid vägens slut",
"rating" : 9.0,
"thumbnail" : "special://masterprofile/Thumbnails/Video/a/a8c81876.tbn"
},
{
"id" : 50,
"fanart" : "special://masterprofile/Thumbnails/Video/Fanart/7655f397.tbn",
"file" : "/home/xedar/movietest/Sommar.med.göran/sommargöran.mkv",
"label" : "Sommaren med Göran – En midsommarnattskomedi",
"movieid" : 2,
"originaltitle" : "Sommaren med Göran – En midsommarnattskomedi",
"rating" : 4.50,
"thumbnail" : "special://masterprofile/Thumbnails/Video/7/7655f397.tbn"
}
],
"start" : 0,
"total" : 2
}
}
Problem is iam limited to none JSON, i send request to raw TCP and match with regex.
We use Iviewer for Ipad http://www.commandfusion.com/
right now I do it ugly, matching the "movieid" field instead of id # for movies and yes regex can be a pain when parsing alot...
I can understand its not a good feature to change standard JSON outputs.
Best regards.