vibe.d beta banner
get vibe.d
0.10.1

Asynchronous I/O that doesn’t get in your way, written in D

Struct JsonStringSerializer

Serializer for a range based plain JSON string representation.

struct JsonStringSerializer(R, bool pretty = false)
  
if (isInputRange!R || isOutputRange!(R, char));

Constructors

NameDescription
this (range)

Fields

NameTypeDescription
m_firstInComposite bool
m_level size_t
m_line int
m_range R

Methods

NameDescription
beginReadArrayEntry (index)
beginReadDictionaryEntry (name)
beginWriteArray ()
beginWriteArrayEntry ()
beginWriteDictionary ()
beginWriteDictionaryEntry (name)
endComposite ()
endReadArrayEntry (index)
endReadDictionaryEntry (name)
endWriteArray ()
endWriteArrayEntry ()
endWriteDictionary ()
endWriteDictionaryEntry (name)
getSerializedResult ()
indent ()
readArray (size_callback, entry_callback)
readDictionary (entry_callback)
readValue ()
skipValue ()
startComposite ()
startCompositeEntry ()
tryReadNull ()
writeStringSinkValue (value)
writeValue (value)

See Also

vibe.data.serialization.serialize, vibe.data.serialization.deserialize, serializeToJson, deserializeJson

Example

Cloning JSON arrays

Json value = Json([ Json([ Json.emptyArray ]), Json.emptyArray ]).clone;

assert(value.length == 2);
assert(value[0].length == 1);
assert(value[0][0].length == 0);
Authors

Sönke Ludwig

Copyright

© 2012-2015 Sönke Ludwig

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.