org.mule.module.json
Class JsonData
java.lang.Object
org.mule.module.json.JsonData
- All Implemented Interfaces:
- Serializable
public class JsonData
- extends Object
- implements Serializable
A wrapper for the JsonNode
object that
allows for nested object keys i.e. user/name will return the name property on
the user object.
There is no 'xpath' for JSON yet (though I expect Jackson to do implement this at some point).
This class provides a simple way to navigate a Json data structure. To select a child entry use -
person/name
to access array data, use square braces with an index value i.e.
person/addresses[0]/postcode
or
[0]/arrayElement
Also, multi-dimensional arrays can be accessed using:
filters[1]/init[1][0]
if a Json property name contains a '/' the name needs to be quoted with single quotes i.e.
results/'http://foo.com'/value
- See Also:
- Serialized Form
JsonData
public JsonData(org.codehaus.jackson.JsonNode node)
JsonData
public JsonData(URL node)
throws IOException
- Throws:
IOException
JsonData
public JsonData(InputStream node)
throws IOException
- Throws:
IOException
JsonData
public JsonData(Reader node)
throws IOException
- Throws:
IOException
JsonData
public JsonData(String node)
throws IOException
- Throws:
IOException
get
public org.codehaus.jackson.JsonNode get(int index)
isArray
public boolean isArray()
toArray
public org.codehaus.jackson.JsonNode[] toArray()
get
public org.codehaus.jackson.JsonNode get(String expression)
getAsString
public String getAsString(String expression)
hasNode
public boolean hasNode(String key)
parseTokens
protected List<String> parseTokens(String expresion)
equals
public boolean equals(Object obj)
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.