Module: RustyJson
- Defined in:
- lib/rusty_json.rb,
lib/rusty_json/parser.rb,
lib/rusty_json/version.rb,
lib/rusty_json/rust_struct.rb more...
Overview
RustyJson is a gem to support [Rust](www.rust-lang.org) development when using JSON. For a deeply nested JSON object, one may create many structs to define the syntax of the expected JSON. RustyJson merely Aims to reduce that :)
Defined Under Namespace
Classes: Parser, RustStruct
Constant Summary collapse
- VERSION =
"1.2.3"
Class Method Summary collapse
-
.parse(json, name = 'JSON') ⇒ Object
Example Usage:.
Class Method Details
permalink .parse(json, name = 'JSON') ⇒ Object
Example Usage:
json = File.read(‘json_file.json’) rust = RustyJson.parse(json) File.write(‘output_structs.rs’, rust)
In the above example, RustyJson will parse the JSON in the file: json_file.json and then you print the rust structs out to a Rust File.
25 26 27 28 |
# File 'lib/rusty_json.rb', line 25 def self.parse(json, name = 'JSON') parser = Parser.new(name, json) parser.parse end |