Returns the {@link SearchBuilder} represented by the specified JSON {@code String}.

@param json the JSON {@code String} representing a {@link SearchBuilder}
@return the {@link SearchBuilder} represented by the specified JSON {@code String}
491274
static SearchBuilder fromJson(String json) {
        try {
            return JsonSerializer.fromString(json, SearchBuilderLegacy.class).builder;
        } catch (IOException e) {
            throw new IndexException(e, "Unparseable JSON search: {}", json);
        }
    }
670647
public Map<String, Object> jsonToMap(String json) {

        /*
         * This if block treats the /v2/accounts/exists response. Currently the endpoint returns the status
         * code on its response body, breaking the JSON conversion.
         */
        if ("200".equals(json)) {
            this.responseBody.put("code", 200);
            return this.responseBody;
        }

        if ("400".equals(json)) {
            this.responseBody.put("code", 400);
            return this.responseBody;
        }

        if ("404".equals(json)) {
            this.responseBody.put("code", 404);
            return this.responseBody;
        }

        if (!json.equals("")) {
            ObjectMapper mapper = new ObjectMapper();
            try {
                this.responseBody = mapper.readValue(json, new TypeReference<Map<String, Object>>(){});
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return this.responseBody;
    }
682603
public static Workspace fromJson(String json) throws Exception {
        if (json == null || json.trim().length() == 0) {
            throw new IllegalArgumentException("A JSON string must be provided.");
        }

        StringReader stringReader = new StringReader(json);
        return new JsonReader().read(stringReader);
    }
433173
@SuppressWarnings({"unchecked"})
    public <T> T read(String json, Configuration configuration) {
        notEmpty(json, "json can not be null or empty");
        notNull(configuration, "jsonProvider can not be null");

        return read(configuration.jsonProvider().parse(json), configuration);
    }
1345203
@javax.annotation.Nonnull
  public JsonObject getJson() {
    @javax.annotation.Nonnull final JsonObject json = new JsonObject();
    json.addProperty("min", min);
    json.addProperty("max", max);
    json.addProperty("negatives", negatives);
    json.addProperty("positives", positives);
    json.addProperty("zeros", zeros);
    json.addProperty("sum0", sum0);
    json.addProperty("sum1", sum1);
    json.addProperty("sum2", sum2);
    json.addProperty("sumLog", sumLog);
    return json;
  }
822297
public JSONArray getJSONArray( String key ) {
      verifyIsNull();
      Object o = get( key );
      if( o != null && o instanceof JSONArray ){
         return (JSONArray) o;
      }
      throw new JSONException( "JSONObject[" + JSONUtils.quote( key ) + "] is not a JSONArray." );
   }
588255
public static TransformProcess fromJson(String json) {
        try {
            return JsonMappers.getMapper().readValue(json, TransformProcess.class);
        } catch (IOException e) {
            //TODO proper exception message
            throw new RuntimeException(e);
        }
    }
111021
public static SchemaBuilder fromJson(String json) {
        try {
            return JsonSerializer.fromString(json, SchemaBuilder.class);
        } catch (IOException e) {
            throw new IndexException(e, "Unparseable JSON schema: {}: {}", e.getMessage(), json);
        }
    }
609896
public String getStringFrom(JsonValue json) {
    if (json.isString()) {
      return json.asString();
    } else {
      return json.toString();
    }
  }
626209
public RecordedQuery fromJSON(String json) {
		RecordedQuery ret = new RecordedQuery(false);
		StringReader sr = new StringReader(json);
		JsonReader reader = Json.createReader(sr);
		JsonObject jsonResult = reader.readObject();
		
		ret.setGeneric(jsonResult.getBoolean(GENERIC));
		JsonArray augmentations = jsonResult.getJsonArray(AUGMENTATIONS);
		if (augmentations != null) {
			Map<String, String> augs = new HashMap<String, String>();
			Iterator<JsonValue> ait = augmentations.iterator();
			while(ait.hasNext()) {
				JsonObject a = (JsonObject) ait.next();
				augs.put(a.getString(KEY), a.getString(VALUE));
			}
			ret.setAugmentations(augs);
		}
		
		JsonArray statements = jsonResult.getJsonArray(STATEMENTS);
		Iterator<JsonValue> it = statements.iterator();
		while(it.hasNext()) {
			JsonValue s = it.next();
			readStatement(s, ret.getStatements(), ret);
		}
		return ret;
	}
606350
public static JSONObject fromJSON(String json) {
    int index1 = json.lastIndexOf("\"_i\":\"");
    if (index1 < 0)
      throw new JsonParseException("Unable to find _i key.");
    index1 += 6;
    int index2 = json.indexOf("\"", index1 + 1);
    if (index2 < 0)
      throw new JsonParseException("Unable to find end of _i value.");
    String id = json.substring(index1, index2);
    Class<? extends JSONObject> clazz = registrations.get(id);
    if (clazz == null){
      // See if the id is a full classname
      try{
        clazz = (Class<? extends JSONObject>) Class.forName(id);
        registrations.put(id, clazz);
      }catch(ClassNotFoundException ex){
        throw new JsonParseException("No registration for JSONObject message.identifier:" + id);
      }
    }
    return fromJSON(json, clazz);
  }
346887
public static <T extends BaseBo> T fromJson(String json, Class<T> clazz) {
        return fromJson(json, clazz, null);
    }
1085381
public String jsonToXml(String json){
        String xml = "";
        // 處理直接以陣列開頭的JSON，並指定給予 row 的 tag
        if ( "[".equals( json.substring(0,1) ) ){
            xml = XML.toString(new JSONArray(json), "row");
        }else{
            xml = XML.toString(new JSONObject(json));
        }

        return xml;
    }
484122
public static Expression decodeJson(JsonObject json) {
        char[] encoded = JsonStringEncoder.getInstance().quoteAsString(json.toString());
        return x("DECODE_JSON(\"" + new String(encoded) + "\")");
    }
110962
@SuppressWarnings("unused")
  public static CarmenContext fromJson(@NonNull String json) {
    Gson gson = new GsonBuilder()
      .registerTypeAdapterFactory(GeocodingAdapterFactory.create())
      .create();
    return gson.fromJson(json, CarmenContext.class);
  }
449006
public static Object fromJson(String json) {
    try {
      JSONObject jsonObject = new JSONObject(json);
      if (jsonObject.has("JSON")) {
        return convert(jsonObject.get("JSON"));
      } else {
        return convert(jsonObject);
      }
    } catch (Exception e) {
      throw new RuntimeException("json=" + json, e);
    }
  }
1229562
public static BoxEntity createEntityFromJson(final JsonObject json){
        JsonValue typeValue = json.get(BoxEntity.FIELD_TYPE);
        if (!typeValue.isString()) {
            return null;
        }
        String type = typeValue.asString();
        BoxEntityCreator creator = ENTITY_ADDON_MAP.get(type);
        BoxEntity entity = null;
        if (creator == null){
            entity = new BoxEntity();
        } else {
            entity = creator.createEntity();
        }
        entity.createFromJson(json);
        return entity;
    }