Package org.json.simple

Source Code of org.json.simple.JSONValue

/*
* $Id: JSONValue.java,v 1.1 2007-06-05 00:43:56 tuxpaper Exp $
* Created on 2006-4-15
*/
package org.json.simple;

import java.io.Reader;
import java.io.StringReader;

import org.json.simple.parser.JSONParser;


/**
* @author FangYidong<fangyidong@yahoo.com.cn>
*/
public class JSONValue {
  /**
   * parse into java object from input source.
   * @param in
   * @return instance of : JSONObject,JSONArray,String,Boolean,Long,Double or null
   */
  public static Object parse(Reader in){
    try{
      JSONParser parser=new JSONParser();
      return parser.parse(in);
    }
    catch(Exception e){
      return null;
    }
  }
 
  public static Object parse(String s){
    StringReader in=new StringReader(s);
    return parse(in);
  }
}
TOP

Related Classes of org.json.simple.JSONValue

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.