[uf-discuss] Generically converting JSON to POSH
Nirmal Patel
nirmal at gatech.edu
Mon Jul 14 07:31:39 PDT 2008
On Mon, Jul 14, 2008 at 10:24 AM, Kevin Marks <kevinmarks at gmail.com> wrote:
> XOXO is the generic way to turn JSON into HTML (and back) - see
>
> http://www.mail-archive.com/microformats-discuss@microformats.org/msg06827.html
>
> The problem is knowing what are user-visible keys and what aren't
My current solution is about quickly styling all of the content. So
you can explore
your styling options. Maybe for deployment it should be possible to pass
a xpath style filter to limit which nodes are converted.
I like your server side script (Go Python!) but I wanted to stick to JS because
I wanted something to use with results of JS Badge calls where JSON returns
are the norm.
>
> On Mon, Jul 14, 2008 at 6:01 AM, Nirmal Patel <nirmal at gatech.edu> wrote:
>>
>> On Mon, Jul 14, 2008 at 4:52 AM, Toby A Inkster <mail at tobyinkster.co.uk> wrote:
>> <snip>
>> > Looks quite good. Personally I'd have converted JSON objects into definition
>> > lists using DT for the key and DD for the value though. Then perhaps add the
>> > key to the class of each *as well*. So, for instance:
>> >
>> > {
>> > "key1" : "value1" ,
>> > "key2" : "value2"
>> > }
>> >
>> > becomes:
>> >
>> > <dl class="json-object">
>> > <dt class="key1">key1</dt>
>> > <dd class="key1">value1</dt>
>> > <dt class="key2">key2</dt>
>> > <dd class="key2">value2</dt>
>> > </dl>
>>
>> I had initially done this but came to the conclusion that this put key1 into
>> the html as content and that seemed wrong.
>>
>> >
>> > Which should be more flexible with regards to styling, and probably more
>> > useful when looked at without CSS. If you happen to like the unordered list
>> > look, then:
>>
>> I never intended to use the results of this library for exploring the JS. I
>> suppose that this should be made more explicit.
>>
>> >
>> > dl.json-object dt { display: none; }
>> > dl.json-object dd { list-style-type: circle; }
>>
>> And this was exactly how I styled the result. :)
>>
>> >
>> > However, have you considered what happens when the object keys contain
>> > whitespace characters? e.g.
>> >
>> > {
>> > "some key" : "some value"
>> > }
>> >
>> > --
>> > Toby A Inkster
>> > <mailto:mail at tobyinkster.co.uk>
>> > <http://tobyinkster.co.uk>
>> >
>> >
>> >
>> > _______________________________________________
>> > microformats-discuss mailing list
>> > microformats-discuss at microformats.org
>> > http://microformats.org/mailman/listinfo/microformats-discuss
>> >
>>
>>
>>
>> --
>> Nirmal Patel
>> www.nirmalpatel.com
>> _______________________________________________
>> microformats-discuss mailing list
>> microformats-discuss at microformats.org
>> http://microformats.org/mailman/listinfo/microformats-discuss
> _______________________________________________
> microformats-discuss mailing list
> microformats-discuss at microformats.org
> http://microformats.org/mailman/listinfo/microformats-discuss
>
--
Nirmal Patel
www.nirmalpatel.com
More information about the microformats-discuss
mailing list