Comments (3)
What is the value of feedKey when you get the exception? I pass "123"
(http://www.iobridge.com/api/feed/key=123) and get the result:
{{{
{
"module": {
"serial": "",
"label": "",
"lat": "",
"long": "",
"location": "",
"datetime": "Feb-17-2009 06:44:25 AM",
"status": "Offline",
"channels": [
]
}}
}}}
It seems that the top level entity is a JSON object, not a JSON array.
Original comment by [email protected]
on 17 Feb 2009 at 11:53
from json-simple.
Hey thanks for the reply.
Setting it to cast as a JSONObject works well.
I am somewhat new to parsing and handling JSON in Java, do you know of any good
tutorials how I could access
say the array of channels or even the status?
Thanks,
Callum
Original comment by [email protected]
on 18 Feb 2009 at 4:01
from json-simple.
JSONObject is a java.util.Map and JSONArray is a java.util.List, so you can
access it
with standard operations of Map or List:
JSONObject obj = (JSONObject) parser.parse(jsonData);
JSONObject module = (JSONObject) obj.get("module");
JSONArray channels = (JSONArray) module.get("channels");
Please refer
http://code.google.com/p/json-simple/wiki/MappingBetweenJSONAndJavaEntities for
mapping of entities. You can also join the discussion group
(http://groups.google.com/group/json-simple) if you have further questions on
using
JSON.simple.
Original comment by [email protected]
on 18 Feb 2009 at 4:47
- Changed state: Invalid
from json-simple.
Related Issues (20)
- escaped backslash results in new line character if followed by 'n' or 'r' HOT 1
- JSONParser.parse() throws a parse exception on trailing and leading whitespace of a JSON String. HOT 1
- Make junit's scope to test HOT 3
- Build JSONArray from a Collection HOT 1
- StringBuilder and StringBuffer values are unquoted HOT 1
- I need to modify JSON object value at run time.
- Move project to Github HOT 2
- Migrating to GitHub? HOT 1
- MVN Repo and direct download from https://code.google.com/p/json-simple/ are different jars for the same version 1.1.1
- linkedHashMap does not preserve order once data has reached client
- Please provide a source archive for release 1.1.1
- MAVEN, json-simple 1.1.1 depends on Junit HOT 4
- bug in get(), ContainerFactory HOT 1
- JSONObject produces warning in code HOT 6
- Long cast error, even if String used HOT 2
- Patch for /trunk/src/main/java/org/json/simple/parser/ContainerFactory.java HOT 2
- nothing is being converted to a JSONObject in my java class, throwing an exception HOT 1
- Building 1.1.1 with java-1.8.0 tests fail - hash not matching? HOT 2
- Functions are missing from json_simple.jar (1.1)
- should not always use toString() as fallback in JSONValue.writeJSONString() HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-simple.