MJPA/SimpleJSON — pull request #18 by rudifa (2013-11-03 16:46:58+00:00)
Title: Added the Prettyprint extension

Hello

Perhaps you will find the proposed extension useful to developers and uses of SimpleJSON.
Comments and criticism will be welcome.

*Please disregard my earlier Pull Request for the branch `prettyprint`.
This request contains the same code changes, less my inadvertent whitespace changes, all in one commit instead of 4.*

Rudi

`JSON::Stringify()` : as before, returns a compact JSON string (no whitespace between tokens).
`JSON::Stringify(true)` : added, returns a prettyprinted string with indentation and newlines that reveal the structure of collection objects.

Options added to demo main() :
`-p` is similar to `-e`, but it echoes a prettyprinted JSON string.
`-ex3` returns a larger example, in compact and in prettyprinted versions:

```
$ xcode5 -ex3
-----------
{"SelectedTab":"Math","Widgets":[{"WidgetIndex":1,"WidgetPosition":[0,369,800,582],"WidgetType":"WidgetCheckbox.1"},{"Caption":"On","CaptionPosition":2,"ControlHeight":36,"ControlWidth":25,"EnableCaption":-1,"Font":0,"IsWidgetVisible":-1,"Name":"F2.View","Value":"Off","WidgetIndex":2,"WidgetPosition":[235,453,283,489],"WidgetType":"WidgetCheckbox.1"},{"Caption":"On","CaptionPosition":2,"ControlHeight":36,"ControlWidth":25,"EnableCaption":-1,"Font":0,"IsWidgetVisible":-1,"Name":"F3.View","Value":"Off","WidgetIndex":3,"WidgetPosition":[235,494,283,530],"WidgetType":"WidgetCheckbox.1"},{"Caption":"On","CaptionPosition":2,"ControlHeight":36,"ControlWidth":25,"EnableCaption":-1,"Font":0,"IsWidgetVisible":-1,"Name":"F4.View","Value":"Off","WidgetIndex":4,"WidgetPosition":[235,536,283,572],"WidgetType":"WidgetCheckbox.1"},{"AlignText":0,"Caption":"","CaptionOnly":0,"CaptionPosition":1,"ControlHeight":22,"ControlWidth":113,"EnableBorder":0,"EnableCaption":0,"Font":0,"IsWidgetVisible":-1,"Name":"F1.Equation","Value":"FFT(C1)","WidgetIndex":9,"WidgetPosition":[287,417,400,439],"WidgetType":"WidgetStaticText.1"},{"ButtonOnly":-1,"Caption":"F1","CaptionPosition":1,"ControlHeight":36,"ControlWidth":39,"EnableCaption":0,"Font":0,"IsWidgetVisible":0,"Name":"F1.MeasureOpGui","PickerTitle":"Select Measurement To Graph","Value":"Amplitude","WidgetIndex":17,"WidgetPosition":[191,409,230,445],"WidgetType":"WidgetProcessorCombobox.1"},{"ButtonOnly":-1,"Caption":"F1","CaptionPosition":1,"ControlHeight":36,"ControlWidth":39,"EnableCaption":0,"Font":0,"IsWidgetVisible":-1,"Name":"F1.Operator1gui","PickerTitle":"Select Math Operator","Value":"FFT","WidgetIndex":25,"WidgetPosition":[191,409,230,445],"WidgetType":"WidgetProcessorCombobox.1"},{"ButtonOnly":-1,"Caption":"F2","CaptionPosition":1,"ControlHeight":36,"ControlWidth":39,"EnableCaption":0,"Font":0,"IsWidgetVisible":-1,"Name":"F2.Operator1gui","PickerTitle":"Select Math Operator","Value":"Zoom","WidgetIndex":26,"WidgetPosition":[191,452,230,487],"WidgetType":"WidgetProcessorCombobox.1"}]}
-----------
{
"SelectedTab":"Math","Widgets":[
{
"WidgetIndex":1,"WidgetPosition":[
0,369,800,582
],"WidgetType":"WidgetCheckbox.1"
},{
"Caption":"On","CaptionPosition":2,"ControlHeight":36,"ControlWidth":25,"EnableCaption":-1,"Font":0,"IsWidgetVisible":-1,"Name":"F2.View","Value":"Off","WidgetIndex":2,"WidgetPosition":[
235,453,283,489
],"WidgetType":"WidgetCheckbox.1"
},{
"Caption":"On","CaptionPosition":2,"ControlHeight":36,"ControlWidth":25,"EnableCaption":-1,"Font":0,"IsWidgetVisible":-1,"Name":"F3.View","Value":"Off","WidgetIndex":3,"WidgetPosition":[
235,494,283,530
],"WidgetType":"WidgetCheckbox.1"
},{
"Caption":"On","CaptionPosition":2,"ControlHeight":36,"ControlWidth":25,"EnableCaption":-1,"Font":0,"IsWidgetVisible":-1,"Name":"F4.View","Value":"Off","WidgetIndex":4,"WidgetPosition":[
235,536,283,572
],"WidgetType":"WidgetCheckbox.1"
},{
"AlignText":0,"Caption":"","CaptionOnly":0,"CaptionPosition":1,"ControlHeight":22,"ControlWidth":113,"EnableBorder":0,"EnableCaption":0,"Font":0,"IsWidgetVisible":-1,"Name":"F1.Equation","Value":"FFT(C1)","WidgetIndex":9,"WidgetPosition":[
287,417,400,439
],"WidgetType":"WidgetStaticText.1"
},{
"ButtonOnly":-1,"Caption":"F1","CaptionPosition":1,"ControlHeight":36,"ControlWidth":39,"EnableCaption":0,"Font":0,"IsWidgetVisible":0,"Name":"F1.MeasureOpGui","PickerTitle":"Select Measurement To Graph","Value":"Amplitude","WidgetIndex":17,"WidgetPosition":[
191,409,230,445
],"WidgetType":"WidgetProcessorCombobox.1"
},{
"ButtonOnly":-1,"Caption":"F1","CaptionPosition":1,"ControlHeight":36,"ControlWidth":39,"EnableCaption":0,"Font":0,"IsWidgetVisible":-1,"Name":"F1.Operator1gui","PickerTitle":"Select Math Operator","Value":"FFT","WidgetIndex":25,"WidgetPosition":[
191,409,230,445
],"WidgetType":"WidgetProcessorCombobox.1"
},{
"ButtonOnly":-1,"Caption":"F2","CaptionPosition":1,"ControlHeight":36,"ControlWidth":39,"EnableCaption":0,"Font":0,"IsWidgetVisible":-1,"Name":"F2.Operator1gui","PickerTitle":"Select Math Operator","Value":"Zoom","WidgetIndex":26,"WidgetPosition":[
191,452,230,487
],"WidgetType":"WidgetProcessorCombobox.1"
}
]
}
-----------
```