Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement UnmarshalJSON interface #14

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

levinalex
Copy link

This patch makes it possible to deserialize JSON into jason.Values directly. This is useful if jason.Values are used as part of a larger struct like so:

type X struct {
  key string `json:"key"`
  value jason.Value `json:"value"`
}

var x X

str := `{"key": "foo", "value": { "a": 3, "b": "bar" }}`
json.Unmarshal([]byte(str), &x)

For this to be useful I had to move Implementations of the Get...set of methods from Object over to Value, I'm not sure this is correct and a good Idea. I don't really understand why the Value/Object distinction exists.

@tgccc
Copy link

tgccc commented May 10, 2016

iosjason

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants