Construct JWSHeader from json string.

@param json
json string.

@return Constructed JWSHeader
332284
public static JWSHeader deserialize(String json) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        return mapper.readValue(json, JWSHeader.class);
    }
1017948
@SuppressWarnings("unchecked")
    public static Map<String, Object> toMap(String json) {
        return (Map<String, Object>) JSON.parse(json);
    }
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);
        }
    }
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);
        }
    }
1073664
protected <T> T fromJsonString(String json, Class<T> clazz) {
		return _gsonParser.fromJson(json, clazz);
	}
852376
@SuppressWarnings("UnusedDeclaration")
  public static Bindings fromJson( String json )
  {
    try
    {
      return PARSER.get().parseJson( json );
    }
    catch( ScriptException e )
    {
      throw new RuntimeException( e );
    }
  }
150195
public static GeoShape fromJson(String json) {
        try {
            return JsonSerializer.fromString(json, GeoShape.class);
        } catch (IOException e) {
            throw new IllegalArgumentException("Unparseable shape");
        }
    }
29331
public static Header decode(String header) {
    // verify to json with JAX-RS standard
    JsonObject json;
    try {
      json = Json.createReader(new ByteArrayInputStream(Base64.getUrlDecoder().decode(header))).readObject();
    } catch (JsonException e) {
      throw new DecodeException("Failed convert to JsonObject", e);
    } catch (IllegalArgumentException e) {
      throw new DecodeException("The header is not in valid Base64 scheme", e);
    }

    // validate the typ parameter
    String type = json.containsKey("typ") ? json.getString("typ") : null;
    if (type != null && !DEFAULT_TYPE.equals(type))
      throw new DecodeException("The header type '" + type + "' is not support.");

    // validate the alg parameter
    String algorithm = json.containsKey("alg") ? json.getString("alg") : null;
    if (algorithm != null && !Algorithm.HS256.name().equals(algorithm))
      throw new DecodeException("The header algorithm '" + algorithm + "' is not support.");

    // construct a header instance
    if (DEFAULT_TYPE.equals(type) && Algorithm.HS256.name().equals(algorithm)) {
      // optimise the default standard header to always the same instance
      return Header.DEFAULT;
    } else {
      // create a whole new instance
      Header h = new Header();
      h.type = type;
      h.algorithm = (algorithm != null ? Algorithm.valueOf(algorithm) : null);
      return h;
    }
  }
1206471
public static S3Link fromJson(S3ClientCache s3cc, String json) {
        ID id = Jackson.fromJsonString(json, ID.class);
        return new S3Link(s3cc, id);
    }
14888
public static <T extends MailChimpObject> T fromJson(String json, Class<T> clazz) {
		try {
			return MailChimpGsonFactory.createGson().fromJson(json, clazz);
		} catch(JsonParseException e) {
			throw new IllegalArgumentException(e);
		}
	}
173479
public static <T> T fromJson(JsonNode json, Class<T> clazz) {
        return fromJson(json, clazz, null);
    }
886711
public static Properties parseJSON(String json) {
    try {
      return utilsImpl.parseJSON(json);
    } catch (Exception e) {
      if (!GWT.isProdMode()) {
        System.err.println("Error while parsing json: " + e.getMessage() + ".\n" + json);
      }
      return Properties.create();
    }
  }
1329490
public static DataAnalysis fromJson(String json) {
        try{
            return new JsonSerializer().getObjectMapper().readValue(json, DataAnalysis.class);
        } catch (Exception e){
            //Legacy format
            ObjectMapper om = new JsonSerializer().getObjectMapper();
            return fromMapper(om, json);
        }
    }
549319
public static Document fromJson(String jsonString) {
      try {
         return read(Resources.fromString(jsonString));
      } catch (IOException e) {
         throw Throwables.propagate(e);
      }
   }
878570
public static Object fromJsonString(String jsonString, ClassLoader classLoader) {
        return fromJsonString(jsonString, Object.class, classLoader);
    }
844321
protected JsonObject silentlyCreateObjectFromString(String json) {
    JsonObject errorObject = null;

    // We need to swallow exceptions here because it's possible to get a legit
    // Facebook response that contains illegal JSON (e.g.
    // users.getLoggedInUser returning 1240077) - we're only interested in
    // whether or not there's an error_code field present.
    try {
      errorObject = Json.parse(json).asObject();
    } catch (ParseException e) {
      // do nothing here
    }

    return errorObject;
  }
186328
public static function fromJson($json)
    {
        $responseData = json_decode($json, true);

        if (! $responseData) {
            return new Response(false, ['invalid-json']);
        }

        if (isset($responseData['success']) && $responseData['success'] == true) {
            return new Response(true);
        }

        if (isset($responseData['error-codes']) && is_array($responseData['error-codes'])) {
            return new Response(false, $responseData['error-codes']);
        }

        return new Response(false);
    }