How about just including a json parser/stringer?
http://gggeek.altervista.org/sw/article_20070425.html

Fabian Howahl wrote:
> Hi,
>
> On Jul 30, 2009, at 9:29 PM, Markus Krötzsch wrote:
>>> Also, the json being outputted is invalid. (At least from what I get on
>>> Wikia, I don't know about trunk):
>>> Doing an #ask format=json on yugioh.wikia's Dark Magician for ?English
>>> Name, ?ATK, and ?DEF gives me this.
>>> {
>>>    properties: {
>>>        "english_name" : { valueType: "text" },
>>>        "atk" : { valueType: "number" },
>>>        "def" : { valueType: "number" }
>>>    },
>>>    items: [
>>>        {
>>>            label: "Dark Magician",
>>>            "english_name": "Dark Magician",
>>>            "atk": 2500,
>>>            "def": 2100,
>>>            "uri" : "http://yugioh.wikia.com/index.php?title=Dark 
>>> Magician"
>>>        }
>>>    ]
>>> }
>>>
>>> In JSON ALL keys MUST be wrapped with DOUBLE quotes. the properties:
>>> valueType: items: and label: listed there are all invalid because they
>>> are not wrapped in double quotes.
>>> All valid JSON parsers will reject the json outputted by SMW.
>>
>> The JSON was engineered to be accepted by Exhibit, so this may be the 
>> reason
>> for this peculiarity. I hope Fabian can comment on this. It might 
>> also be
>> fixed: I recently updated the JSON export with some input that Fabian 
>> sent me.
>
> Right, the output the JSON exporter currently delivers is formatted in 
> Exhibit JSON 
> (http://simile.mit.edu/wiki/Exhibit/Creating,_Importing,_and_Managing_Data). 
>
> Indeed, Exhibit JSON holds some peculiarities that might cause 
> problems when it is processed by certain JSON parsers.
> The quotation marks issue you noted is one of these peculiarities. To 
> be compliant with some tools that utilize Exhibit, the JSON exporter 
> refrains from wrapping special properties with quotation marks at the 
> moment.
> I think this approach is going to be changed soon, once all these 
> tools get along with "real" JSON (it is just a matter of time).
>
>
>>> Also, wouldn't it be a good idea to at least note that we're modifying
>>> the keys that the query asked for? Something like a "normalized": {
>>> "English Name": "english_name", "ATK": "atk", "DEF", "def" }, at the 
>>> top.
>
>
> I had a similar idea and I am going to take this into account for 
> future releases.
>
> -Fabian
>
>
>

-- 
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Semediawiki-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to