JsonPrinter

haxe.format.JsonPrinter (Class)

An implementation of JSON printer in Haxe.

This class is used by haxe.Json when native JSON implementation is not available.

See: https://haxe.org/manual/std-Json-encoding.html

Static Members

print(o: Dynamic, ?replacer: Function, ?space: String): String

Encodes o's value and returns the resulting JSON string.

If replacer is given and is not null, it is used to retrieve actual object to be encoded. The replacer function takes two parameters, the key and the value being encoded. Initial key value is an empty string.

If space is given and is not null, the result will be pretty-printed. Successive levels will be indented by this string.

Name Type Default
o Dynamic
replacer Function (optional)
space String (optional)
Returns
String

Private Members


indent: String

pretty: Bool

nind: Int

replacer(key: Dynamic, value: Dynamic): Dynamic
Name Type
key Dynamic
value Dynamic
Returns
Dynamic

ipad(): Void

newl(): Void

write(k: Dynamic, v: Dynamic): Void
Name Type
k Dynamic
v Dynamic

addChar(c: Int): Void
Name Type
c Int

add(v: String): Void
Name Type
v String

classString(v: Dynamic): Void
Name Type
v Dynamic

objString(v: Dynamic): Void
Name Type
v Dynamic

fieldsString(v: Dynamic, fields: Array<String>): Void
Name Type
v Dynamic
fields Array<String>

quote(s: String): Void
Name Type
s String

new(replacer: Function, space: String): Void
Name Type
replacer Function
space String