1. Roland Rosenkranz
  2. libSonParser

Overview

HTTPS SSH
A SON file contains structured text content which is used for configuration and description files. SON is a acronym for Simple Object Notation. The structured content is either a key/value-pair, a array of key/value-pairs or a object (which is a dictionary of key/value-pairs and/or arrays).

These are the semantics of a SON file:

    May contain C-style comments: // starts a line comment. Everything up to the end of the line is ignored. / and / encloses a block comment. Everything within this block is ignored.
    All whitespaces, carriage returns, line feeds and tabs are ignored unless enclosed in double quotation marks.
    Quotes around keys and values are optional unless it contains whitespaces or a colon.
    Comments enclosed by double quotes are handled as keys or values.
    Keys and values are separated by a colon.
    Arrays are enclosed by square brackets ( [ and ] ).
    Array elements can be separated by a comma or a new line.
    Objects are enclosed by curly brackets ( { and } ).
    Object elements can be separated by a comma or a new line.



Example showing all features:



// this is a simple key/value pair
key : value

// quotes around keys and values are optional
"key" : "value"

// ...unless it contains whitespaces or colons
"key with whitespace" : "value:with:colons"

/* block comments are great for commenting out some 
   blocks within a file when testing or to write large
   multiline comments
*/

"array values" : [
  "value1"
  "value2", "value3 is separated by a comma"
]

// another array
"single line array" : [ v1,v2,v3 ]

/* last but not least a object which
   contains a list of key/value pairs */

"myObject" : {
  "name" : "Max"
  "age"  : 21
  city   : Cologne
}