https://github.com/leviongit/dragonjson
https://github.com/leviongit/dragonjson
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/leviongit/dragonjson
- Owner: leviongit
- License: bsd-3-clause
- Created: 2022-07-25T23:24:09.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-05-22T04:52:24.000Z (almost 2 years ago)
- Last Synced: 2024-05-23T00:11:05.881Z (almost 2 years ago)
- Language: Ruby
- Size: 5.06 MB
- Stars: 6
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# dragonjson
## parsing json
```rb
Argonaut::JSON.parse(json_string,
symbolize_keys: boolean,
extensions: boolean)
```
### arguments
1. `json_string` - `String` to be deserialized
2. `symbolize_keys` - `true`/`false` : turn the keys of hashes into `Symbol`s?
3. `extensions` - `true`/`false` : turn the extensions (lossless `Symbol`
deserialization, user object serialization) on?
## serializing basic types to json
```rb
obj.to_json(indent_size: uint,
minify: boolean,
extensions: boolean)
```
### arguments
1. `indent_size` - `uint` : width of indentation
2. `minify` - `true`/`false` : whether to minify the json, overrides `indent_size`
3. `extensions` - `true`/`false` : turn the extensions (lossless `Symbol`
deserialization, user object serialization) on?
### basic types
- `Hash`
- `Array`
- `Integer`
- `Float`
- `true`
- `false`
- `String`
- `Symbol` (lossy conversion if `extensions` is `false`)