Skip to content

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

@zhengchun

Description

@zhengchun

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions