json-rust v0.12.4 Release Notes

Release Date: 2020-03-18 // 3 months 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 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:

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

    You can now write:

    let obj = object! { foo: [1, 2, null], bar: 42};