Skip to content

Commit

Permalink
Note for withLazyNumbers
Browse files Browse the repository at this point in the history
  • Loading branch information
mmastrac authored Nov 1, 2016
1 parent 00be130 commit c342bb3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Or just drop the files directly into your project.
* Apache licensed
* No dependencies

## Parsing example
## Parser example

There are three entry points for parsing, depending on the type of JSON object you expect to parse: `JsonParser.object().from()`, `JsonParser.array().from()`, and `JsonParser.any().from()`.
You pass them a `String` or a `Reader` and they will either return the parsed object of a given type or throw a `JsonParserException`.
Expand All @@ -65,7 +65,12 @@ Errors can be quickly located by using `getLinePosition` and `getCharPosition` o

com.grack.nanojson.JsonParserException: Trailing comma in object on line 4, char 1

## Writing example
For performance-sensitive code, numeric values can be parsed lazily using the `withLazyNumbers` option. JSON numeric values will thehn be
parsed at access time rather than parse time:

JsonObject obj = JsonParser.object().withLazyNumbers().from("{\"abc\":123}");

## Writer example

`JsonWriter` is a simple, stateful JSON writer that can output to a `String`, or to anything implementing the Java `Appendable` interface. The latter includes
`StringBuilder`, `Writer`, `PrintStream`, and `CharBuffer`.
Expand Down

0 comments on commit c342bb3

Please sign in to comment.