+
Skip to content

example for json serialization out of date? #18

@davidsiefert

Description

@davidsiefert

Trying to follow example on nickel-org site for json decoding and it referenced using rustc-serialize. According to the interwebs, rustc-serialize is now deprecated and they recommend using serde (see https://github.com/rust-lang-deprecated/rustc-serialize). Would it be worth updating these docs to use serde as well?

Should be the following changes:

Add two dependencies to Cargo.toml:

serde = { version="0.1.0", features=["derive"] }
serde_json = "1.0"

then in the example, the rust code should use:

use serde::{Deserialize, Serialize};

derive updates to serde's impl:

#[derive(Serialize,Deserialize,Debug)]
struct Person {

and the rest should be the same...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载