[Windmill-dev] JSON Parsing

Bobby Rullo br at osafoundation.org
Thu Dec 6 13:30:44 PST 2007


It is pretty doable. You would just to write a regex expression like  
(roughly) "\{.*\}" - in English, "match on stuff between braces,  
greedily" and then iterate through the matches. Each match would be 1  
JSON object, and it would be compatible with what's already there.

Bobby

On Dec 6, 2007, at 1:14 PM, Mikeal Rogers wrote:

> That's just not doable.
>
> The actual file isn't valid json, it's a json object per line. We
> split on line separators and parse each object. We wouldn't be able to
> parse "pretty json" unless we wrote another parser on top of the json
> parser.
>
> In addition, any formatting you do to those files will be lost if the
> file is loaded in to the IDE, edited, and re-saved.
>
> If you want better looking multi-line formatting you can use python. I
> actually was in the process of moving initialize.json to python for
> that very reason, but i noticed that the API calls for registering
> variables is so ugly that even moving to python didn't help since
> instead of kwargs it takes a list of strings split on "|", which i
> think we should really try to fix in the next release.
>
> In the next release I would push for moving this;
>
> {"method": "commands.createVariables",
> "params":{"variables":["dvSaveButton| 
> cosmo 
> .app 
> .pim 
> .layout 
> .baseLayout 
> .mainApp 
> .rightSidebar.detailViewForm.buttonSection.saveButton.widgetId"}}
>
> To the more sane;
> {"method": "commands.createVariables",
> "params": 
> {"dvSaveButton 
> ":"cosmo 
> .app 
> .pim 
> .layout 
> .baseLayout 
> .mainApp 
> .rightSidebar.detailViewForm.buttonSection.saveButton.widgetId"}}
>
> -Mikeal
>
> On Dec 6, 2007, at December 6, 200711:40 AM, Bobby Rullo wrote:
>
>> It would be nice if the JSON parser would work on so-called "pretty  
>> printed" json. Right now it only seems to work of the whole  
>> structure is one line.
>>
>> This would make stuff like initialize.json MUCH more readable.
>>
>> bobby	
>> _______________________________________________
>> Windmill-dev mailing list
>> Windmill-dev at osafoundation.org
>> http://lists.osafoundation.org/mailman/listinfo/windmill-dev
>



More information about the Windmill-dev mailing list