Hi,


On Thu, Sep 4, 2014 at 2:48 PM, Tim Mackinnon <tim@mackinnon.email> wrote:
Hi guys - excuse me if I have the terminology wrong, but are there any gtInspector tab things for visualising JSON in the inspector?

Yes and no :).

Yes, in the sense that, for example, NeoJSON will get you back a Dictionary, and a Dictionary has the ability to properly offer a tree, which is what you want to see for JSON.

No, in the sense that it is not ideal in that you will get no JSON specific abilities because the returned structure is a generic Dictionary. For example, in JSON, the key is always a string, so you do not want to see the quotes like you would see in the rendering of a generic Dictionary.

 
Inspired from Tudor’s ESUG talk on using moose for non-code things I thought I might explore visualising some cards a team stores in Trello (which is JSON based).

Excellent topic. Please do share that experience because it is a nice show case.

 
I’m building up some objects to model Trello, but they are pulling from some raw JSON and it would be handy to see it more easily in an inspector to work out what I need. I did wonder if Moose had been used on JSON data and whether it had been plugged into GTInspector?

See above. And this is precisely where it fits. You are building the tools to build the tool :). Then of course, once you will get your objects, you will build other views I hope :)

 
If not - maybe there is a little side distraction for me?

Which raises an interesting side question - is there the concept of dynamic tabs in GTInspector? As in - if  have a string and I think it can be rendered in JSon, can I then popup a tab for that visualisation?

Yes. In fact, all presentations are dynamic in that you can specify for each of them a condition that is instance specific like this:

composite ...
    when: [ self isTheInstanceYouCareFor ]
 
Take a look for example at FileReference. There you will see methods like:

gtInspectorGifIn: composite
<gtInspectorPresentationOrder: 10>
composite morph
title: 'Picture';
display: [ self binaryReadStreamDo: [ :stream | GIFReadWriter formFromStream: stream ] ];
when: [ self mimeTypes notNil and: [ self mimeTypes first matches: ZnMimeType imageGif ] ]

gtInspectorJpegIn: composite
<gtInspectorPresentationOrder: 10>
composite morph
title: 'Picture';
display: [ self binaryReadStreamDo: [ :stream | JPEGReadWriter formFromStream: stream ] ];
when: [ self mimeTypes notNil and: [ self mimeTypes first matches: ZnMimeType imageJpeg ] ]

Cheers,
Doru

Tim
_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



--
www.tudorgirba.com

"Every thing has its own flow"