com.google.code.facebookapi
Class JsonHelper

java.lang.Object
  extended by com.google.code.facebookapi.JsonHelper

public class JsonHelper
extends java.lang.Object


Constructor Summary
JsonHelper()
           
 
Method Summary
static java.lang.Object jsonToJavaValue(java.lang.String s)
          Determines the correct datatype for a json string and converts it.
static java.lang.Object parseCallResult(java.lang.Object rawResponse)
          Parses the result of an API call from JSON into Java Objects.
static java.lang.Object stringToValue(java.lang.String s)
          COPIED FROM LATEST JSON.ORG SOURCE CODE FOR JSONObject Try to convert a string into a number, boolean, or null.
static org.json.JSONObject toJson(java.util.Map<java.lang.String,java.lang.String> map)
           
static org.json.JSONArray toJsonListOfMaps(java.util.Collection<java.util.Map<java.lang.String,java.lang.String>> listOfMaps)
           
static org.json.JSONArray toJsonListOfStrings(java.util.Collection<java.lang.String> list)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonHelper

public JsonHelper()
Method Detail

toJson

public static org.json.JSONObject toJson(java.util.Map<java.lang.String,java.lang.String> map)

toJsonListOfStrings

public static org.json.JSONArray toJsonListOfStrings(java.util.Collection<java.lang.String> list)

toJsonListOfMaps

public static org.json.JSONArray toJsonListOfMaps(java.util.Collection<java.util.Map<java.lang.String,java.lang.String>> listOfMaps)

parseCallResult

public static java.lang.Object parseCallResult(java.lang.Object rawResponse)
                                        throws FacebookException
Parses the result of an API call from JSON into Java Objects.

Parameters:
data - an InputStream with the results of a request to the Facebook servers
method - the method
Returns:
a Java Object
Throws:
FacebookException - if data represents an error
java.io.IOException - if data is not readable
See Also:
JSONObject

jsonToJavaValue

public static java.lang.Object jsonToJavaValue(java.lang.String s)
Determines the correct datatype for a json string and converts it. The json.org library really should have a method to do this.


stringToValue

public static java.lang.Object stringToValue(java.lang.String s)
COPIED FROM LATEST JSON.ORG SOURCE CODE FOR JSONObject Try to convert a string into a number, boolean, or null. If the string can't be converted, return the string.

Parameters:
s - A String.
Returns:
A simple JSON value.


Copyright © 2010. All Rights Reserved.