Reputation: 2948
I'm trying to use the Android JSON library, but the version is old and there's no constructor in JSONObject that accepts an InputStream, just a String. I can't read all the contents of the stream to the string because it's longer than the maximum length. Is there a way to add data to the JSONObject after the constructor? If not, how can I upgrade the version in Android?
Upvotes: 0
Views: 201
Reputation: 34
Try to use my open source library: http://code.google.com/p/android-json-rpc/ There is no Input Stream but direct call to JSON REST service.
You can also override the JSONObject class, like this:
package com.m4bce.loisirs_ch;
import java.io.IOException;
import java.io.InputStream;
import org.json.JSONObject;
public class JSONObjectStream extends JSONObject {
public JSONObjectStream(InputStream is) throws IOException {
super();
// your code here
}
}
I hope this help.
Upvotes: 0
Reputation: 29199
Why not you use, Gson Api, its a third party api by Google. Check following links:
http://code.google.com/p/google-gson/
https://sites.google.com/site/gson/gson-user-guide
Upvotes: 1