JsonDoc

[Source]

Top level JSON type containing an entire document. A JSON document consists of exactly 1 value.

class ref JsonDoc

Constructors

create

[Source]

Default constructor building a document containing a single null.

new ref create()
: JsonDoc ref^

Returns

Public fields

var data: (F64 val | I64 val | Bool val |

[None](builtin-None.md) val | [String](builtin-String.md) val | [JsonArray](json-JsonArray.md) ref | 
[JsonObject](json-JsonObject.md) ref)

[Source]

The parsed JSON structure.

Will be a None if parse(source: String) has not been called yet.

Public Functions

string

[Source]

Generate string representation of this document.

fun box string(
  indent: String val = "",
  pretty_print: Bool val = false)
: String val

Parameters

  • indent: String val = ""
  • pretty_print: Bool val = false

Returns

parse

[Source]

Parse the given string as a JSON file, building a document. Raise error on invalid JSON in given source.

fun ref parse(
  source: String val)
: None val ?

Parameters

Returns

parse_report

[Source]

Give details of the error that occurred last time we attempted to parse. If parse was successful returns (0, "").

fun box parse_report()
: (USize val , String val)

Returns

© 2016-2020, The Pony Developers
© 2014-2015, Causality Ltd.
Licensed under the BSD 2-Clause License.
https://stdlib.ponylang.io/json-JsonDoc