Package com.cedarsoftware.io
Class ToonReader
java.lang.Object
com.cedarsoftware.io.ToonReader
Parse TOON (Token-Oriented Object Notation) format into JsonObject structures.
ToonReader produces the same JsonObject/Object[]/primitive structures as JsonParser, allowing seamless integration with the existing Resolver infrastructure for type conversion.
TOON format characteristics:
- Indentation-based structure (2 spaces = 1 level)
- key: value syntax for objects
- Inline arrays: [N]: elem1,elem2,elem3
- List arrays: [N]: followed by - elem lines
- Minimal quoting (only when necessary)
- 5 escape sequences: \\, \", \n, \r, \t
- Author:
- John DeRegnaucourt (jdereg@gmail.com)
Copyright (c) Cedar Software LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
License
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Constructor Summary
ConstructorsConstructorDescriptionToonReader(Reader reader, ReadOptions readOptions) Create a ToonReader that reads from a Reader. -
Method Summary
-
Constructor Details
-
ToonReader
Create a ToonReader that reads from a Reader.- Parameters:
reader- the reader to read TOON content fromreadOptions- configuration options (may be null for defaults)
-
-
Method Details
-
readValue
Read the complete TOON value.- Parameters:
suggestedType- optional type hint for the Resolver- Returns:
- parsed value (JsonObject, Object[], or primitive)
-