Useful functions when dealing with JSON.
The watt.json.sax parser doesn't process any of the output it gives. Use these functions to get data from what it gives you.
Code Map
//! Useful functions when dealing with JSON.
module watt.json.util;
//! Base Exception for the whole json package.
class JSONException : Exception
{
public:
this(msg: string, location: string) { }
}
//! Exception thrown when an error occurs during parsing.
class ParseException : JSONException
{
public:
this(msg: string, location: string) { }
}
fn canBeInteger(data: const(char)[], signed: bool) bool { }
//! Parse a u64 from a JSON number string.
fn parseUlong(data: const(char)[], l: u64) bool { }
//! Parse an i64 from a JSON number string. Returns true if a double was
//! parsed.
fn parseLong(data: const(char)[], l: i64) bool { }
//! Parse a double from a JSON number string.
fn parseDouble(data: const(char)[], d: f64) bool { }
//! Parse a double from a JSON number string, using a pre allocated
//! buffer, resizing it if needed.
fn parseDouble(data: const(char)[], d: f64, buffer: char[]) bool { }
fn parseBool(data: const(char)[]) bool { }
//! Unescape a JSON string and return it.
fn unescapeString(str: const(char)[]) const(char)[] { }
//! Unescape a JSON string and return it.
fn unescapeString(str: const(u8)[]) const(char)[] { }
//! Unescape a JSON string and return it, using a pre allocated buffer and
//! resizing it if needed.
fn unescapeString(str: const(char)[], buffer: char[]) const(char)[] { }
//! Escape a JSON string and return it.
fn escapeString(str: const(char)[]) const(char)[] { }
//! Escape a JSON string and return it, using a pre allocated buffer and
//! resizing it if needed.
fn escapeString(str: const(char)[], buffer: char[]) const(char)[] { }
Base Exception
for the whole json package.
Exception
thrown when an error occurs during parsing.
Parameters
data | |
signed |
If |
Return
true
if data
contains a non-digit character.
Parse a u64
from a JSON number string.
Return
true
if a double was parsed.
Parse an i64
from a JSON number string.
Returns true
if a double was parsed.
Parse a double from a JSON number string.
Returns true
if a double was parsed, false
otherwise.
Parse a double from a JSON number string, using a pre allocated buffer, resizing it if needed.
Return
true
if a double was parsed.
Return
the boolean value of a string.
Unescape a JSON string and return it.
Unescape a JSON string and return it, using a pre allocated buffer and resizing it if needed.
Escape a JSON string and return it.
Escape a JSON string and return it, using a pre allocated buffer and resizing it if needed.