Merge: json: rename and improve the quick and easy `deserialize_json`
authorJean Privat <jean@pryen.org>
Thu, 10 May 2018 22:46:05 +0000 (18:46 -0400)
committerJean Privat <jean@pryen.org>
Thu, 10 May 2018 22:46:05 +0000 (18:46 -0400)
Rename the service `String::from_json_string` to a nicer `deserialize_json`. I believe that the old name was counter-intuitive and may explain why the method was used so rarely/never.

Add the argument `static_type` to `deserialize_json` to limit the type of objects that can be deserialized. This argument is passed directly to the JSON deserializer.

The method `deserialize_json` still prints errors to the console, so it should be used for quick prototypes or scripts.

This could make prettier and safer examples in #2655.

Pull-Request: #2664


Trivial merge