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

new feature: supports new Value() method to gets a native value. #8

Closed
zhengchun opened this issue Jul 6, 2022 · 1 comment
Closed
Labels
enhancement New feature or request feature

Comments

@zhengchun
Copy link
Contributor

This new method Value() will allows your access JSON native data and its type, instead of string.

{
 "name":"John",
  "age":31,
  "female":false
}

After:

doc, _:= jsonquery.Parse(s)
for _, n := range doc.ChildNodes() {
  fmt.Printf("%s: %v[%T]\n", n.Data, n.Value(), n.Value())
}

// Output:

age: 31[float64]
female: false[bool]
name: John[string]

Before:

doc, _:= jsonquery.Parse(s)
for _, n := range doc.ChildNodes() {
  fmt.Printf("%s: %v[%T]\n", n.Data, n.InnerText(), n.InnerText())
}

// Output :

age: 31[string]
female: false[string]
name: John[string]

some discuss on here: antchfx/xpath#77

@zhengchun zhengchun added enhancement New feature or request feature and removed enhancement New feature or request labels Jul 6, 2022
zhengchun added a commit that referenced this issue Jul 6, 2022
@zhengchun
Copy link
Contributor Author

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

No branches or pull requests

1 participant