Changeset 175


Ignore:
Timestamp:
Apr 19, 2011, 11:32:10 PM (11 years ago)
Author:
jmckenna
Message:

add missing function details

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/api/zoo-format-json.txt

    r165 r175  
    8787
    8888indent 
    89   {String} For "pretty" printing, the indent string will be used once for each indentation level.
     89  ``{String}`` For "pretty" printing, the indent string will be used once for each indentation level.
    9090 
    9191.. _space:     
    9292 
    9393space   
    94   {String} For "pretty" printing, the space string will be used after the ":" separating a name/value pair.
     94  ``{String}`` For "pretty" printing, the space string will be used after the ":" separating a name/value pair.
    9595 
    9696.. _newline:       
    9797 
    9898newline
    99   {String} For "pretty" printing, the newline string will be used at the end of each name/value pair or array item.
     99  ``{String}`` For "pretty" printing, the newline string will be used at the end of each name/value pair or array item.
    100100 
    101101.. _level:       
    102102 
    103103level   
    104   {Integer} For "pretty" printing, this is incremented/decremented during serialization.
     104  ``{Integer}`` For "pretty" printing, this is incremented/decremented during serialization.
    105105 
    106106.. _pretty:         
    107107 
    108108pretty 
    109   {Boolean} Serialize with extra whitespace for structure.
     109  ``{Boolean}`` Serialize with extra whitespace for structure. This is set by the :ref:`write <write>` method.
    110110 
    111111**Functions**
     
    115115ZOO.Format.JSON
    116116  Create a new parser for JSON.
     117
     118  *Parameters*
     119 
     120  ``options {Object}`` An optional object whose properties will be set on this instance.
    117121 
    118122.. _read:           
    119123 
    120124read   
     125  ::
     126 
     127    read: function(json,filter)
     128
    121129  Deserialize a json string.
     130
     131  *Parameters*
     132 
     133  | ``json {String}`` A JSON string
     134  | ``filter {Function}`` A function which will be called for every key and value at every level of the final result.  Each value will be replaced by the result of the filter function.  This can be used to reform generic objects into instances of classes, or to transform date strings into Date objects.
     135
     136  *Returns*
     137
     138  ``{Object}`` An object, array, string, or number.
    122139 
    123140.. _write:             
    124141 
    125142write   
     143  ::
     144 
     145    write: function(value,pretty)
     146
    126147  Serialize an object into a JSON string.
     148
     149  *Parameters*
     150 
     151  | ``value {String}`` The object, array, string, number, boolean or date to be serialized.
     152  | ``pretty {Boolean}`` Structure the output with newlines and indentation.  Default is false.
     153
     154  *Returns*
     155
     156  ``{String}`` The JSON string representation of the input value. 
    127157 
    128158.. _writeIndent:               
    129159 
    130160writeIndent     
     161  ::
     162 
     163    writeIndent: function()
     164
    131165  Output an indentation string depending on the indentation level.
    132166 
     167  *Returns*
     168
     169  ``{String}`` An appropriate indentation string.
     170 
    133171.. _writeNewline:               
    134172 
    135173writeNewline   
     174  ::
     175 
     176    writeNewline: function()
     177
    136178  Output a string representing a newline if in pretty printing mode.
    137179 
     180  *Returns*
     181
     182  ``{String}`` A string representing a new line.
     183 
    138184.. _writeSpace:               
    139185 
    140186writeSpace     
    141   Output a string representing a space if in pretty printing mode.
     187  ::
     188 
     189    writeSpace: function()
     190
     191  Output a string representing a space if in pretty printing mode. 
     192
     193  *Returns*
     194
     195  ``{String}`` A space.
    142196 
    143197**Serialize Properties**
     
    146200
    147201serialize       
    148   Object with properties corresponding to the serializable data types.
     202  Object with properties corresponding to the serializable data types. Property
     203  values are functions that do the actual serializing.
    149204 
    150205**Serialize Functions**
     
    154209serialize.object       
    155210  Transform an object into a JSON string.
     211
     212  *Parameters*
     213
     214  ``object {Object}`` The object to be serialized.
     215 
     216  *Returns*
     217
     218  ``{String}`` A JSON string representing the object.
    156219 
    157220.. _serialize.array:                 
     
    159222serialize.array
    160223  Transform an array into a JSON string.
     224
     225  *Parameters*
     226 
     227  ``array {Array}`` The array to be serialized
     228
     229  *Returns*
     230
     231  ``{String}`` A JSON string representing the array.
    161232 
    162233.. _serialize.string:                   
     
    164235serialize.string       
    165236  Transform a string into a JSON string.
     237
     238  *Parameters*
     239 
     240  ``string {String}`` The string to be serialized
     241
     242  *Returns*
     243
     244  ``{String}`` A JSON string representing the string.
    166245 
    167246.. _serialize.number:                     
     
    169248serialize.number       
    170249  Transform a number into a JSON string.
     250
     251  *Parameters*
     252 
     253  ``number {Number}`` The number to be serialized.
     254 
     255  *Returns*
     256
     257  ``{String}`` A JSON string representing the number. 
    171258 
    172259.. _serialize.boolean:                       
     
    174261serialize.boolean       
    175262  Transform a boolean into a JSON string.
     263
     264  *Parameters*
     265 
     266  ``bool {Boolean}`` The boolean to be serialized.
     267
     268  *Returns*
     269
     270  ``{String}`` A JSON string representing the boolean.
    176271 
    177272.. _serialize.date:                         
     
    179274serialize.date 
    180275  Transform a date into a JSON string.
     276
     277  *Parameters*
     278 
     279  ``date {Date}`` The date to be serialized.
     280
     281  *Returns*
     282
     283  ``{String}`` A JSON string representing the date.
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png