Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vrmiguel/tson
Parser for "typed" JSON
https://github.com/vrmiguel/tson
Last synced: about 2 months ago
JSON representation
Parser for "typed" JSON
- Host: GitHub
- URL: https://github.com/vrmiguel/tson
- Owner: vrmiguel
- License: other
- Created: 2022-07-05T00:44:46.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-07-05T01:34:06.000Z (over 2 years ago)
- Last Synced: 2024-10-15T22:10:45.061Z (3 months ago)
- Language: Rust
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TSON
A parser for "TSON", a JSON-like object data-interchange format without the usage of `null`.
## TSON examples
```json
{
"error_code": Some(400),
"body": None
}
``````json
{
"error_code": None,
"body": Some({
"response": "bleblebleble",
})
}
```## Usage
Currently the only entrypoint is the `parse_value`, which receives a string slice and returns a `Value`, which is defined as shown below.
```rust
pub enum Value<'a> {
Float(f64),
Boolean(bool),
String(&'a str),
Char(char),
List(Vec>),
Optional(Option>>),
Object(HashMap<&'a str, Value<'a>>),
}
```