json-rust v0.12.4 Release Notes
Release Date: 2020-03-18 // over 4 years ago-
- ๐ Fixes an issue with new macros requiring types to be copy.
Previous changes from v0.12.3
-
- ๐ Improved macro syntax:
- Object
"key" => value
pair can be now written as either"key": value
orkey: value
without quotes, as long askey
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!
orobject!
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.
- Object
Example
Instead of:
let obj = object! { "foo" =\> array![1, 2, json::Null], "bar" =\> 42};
You can now write:
let obj = object! { foo: [1, 2, null], bar: 42};
- ๐ Improved macro syntax: