Download Latest Version 0.12.4 source code.zip (112.4 kB)
Email in envelope

Get an email when there's a new version of json-rust

Home / v0.12.3
Name Modified Size InfoDownloads / Week
Parent folder
0.12.3 source code.tar.gz 2020-03-17 104.5 kB
0.12.3 source code.zip 2020-03-17 112.4 kB
README.md 2020-03-17 836 Bytes
Totals: 3 Items   217.8 kB 0
  • Improved macro syntax:
    • Object "key" => value pair can be now written as either "key": value or key: value without quotes, as long as key is an identifier.
    • If you want to use the value of the a variable as a key in the new notation, use [foo]: value.
    • When nesting objects or arrays, it's no longer necessary to use invoke array! or object! from within another macro.
    • null is a keyword inside of either macro.
    • This is a backwards compatible change, although mixing notations within a single macro invocation is not permitted.

Example

Instead of:

:::rust
let obj = object! {
    "foo" => array![1, 2, json::Null],
    "bar" => 42
};

You can now write:

:::rust
let obj = object! {
    foo: [1, 2, null],
    bar: 42
};
Source: README.md, updated 2020-03-17