Parses an album response from a
<a href="https://developer.spotify.com/web-api/album-endpoints/">Spotify API album query</a>.

@param json The json response
@return A list of albums with artist information
496431
private ArrayList<Album> parseAlbumData(String json) {
    ArrayList<Album> albums = new ArrayList<>();
    try {
      JsonNode jsonNode = this.objectMapper.readTree(json);
      for (JsonNode albumNode : jsonNode.get("albums")) {
        JsonNode artistsNode = albumNode.get("artists");
        // Exclude albums with 0 artists
        if (artistsNode.size() >= 1) {
          // Only keeping the first artist for simplicity
          Artist artist = new Artist(artistsNode.get(0).get("name").asText());
          Album album = new Album(albumNode.get("name").asText(), artist);
          albums.add(album);
        }
      }
    } catch (IOException e) {
      throw new RuntimeException("Failed to parse JSON", e);
    }
    return albums;
  }
48383
private JsonArray getJsonFromResponse(HttpResponse response) throws IOException
    {
        InputStream content = response.getEntity().getContent();
        Reader reader = new InputStreamReader(content);
        JsonObject json = gson.fromJson(reader, JsonObject.class);
        JsonElement jsonElement = json.get("rows");
        return jsonElement == null ? null : jsonElement.getAsJsonArray();
    }
583783
public List<?> formatJSON2List(String json) {
		List<?> list = null;
		try {
			list = MAPPER.readValue(json, List.class);
		} catch (Exception e) {
			LOGGER.error("formatJSON2List error, json = " + json, e);
		}
		return list;
	}
176250
public Object parseJSON(String strJson) throws ScriptException, NoSuchMethodException {

		Object json = scriptEngine.eval("JSON");
		Object data = invokeMethod(json, "parse", strJson);

		return data;
	}
967697
public static <T extends AlipayResponse> T parseResponse(String json, Class<T> clazz)
                                                                                         throws AlipayApiException {
        ObjectJsonParser<T> parser = new ObjectJsonParser<T>(clazz);
        return parser.parse(json);
    }
46446
public static CmsClientAliasImportResult parse(JSONObject json) {

        String line = getString(json, JSON_LINE);
        String message = getString(json, JSON_MESSAGE);
        String statusStr = getString(json, JSON_STATUS);
        CmsAliasImportStatus status = CmsAliasImportStatus.valueOf(statusStr);
        return new CmsClientAliasImportResult(line, status, message);
    }
868864
public JSONObject getJson() throws JSONException {
        JSONObject json = create();
        if (value != null)
            json.put("value", value);
        if (label != null)
            json.put("label", label);
        if (type != null)
            json.put("type", type);
        if (display != null)
            json.put("display", display.toString());
        if (sequence != 0)
            json.put("sequence", sequence);
        if (indexKey != null)
            json.put("indexKey", indexKey);
        return json;
    }
1289926
public static Diagram parseJson(JSONObject json,
                                    Boolean keepGlossaryLink) throws JSONException {
        ArrayList<Shape> shapes = new ArrayList<Shape>();
        HashMap<String, JSONObject> flatJSON = flatRessources(json);
        for (String resourceId : flatJSON.keySet()) {
            parseRessource(shapes,
                           flatJSON,
                           resourceId,
                           keepGlossaryLink);
        }
        String id = "canvas";

        if (json.has("resourceId")) {
            id = json.getString("resourceId");
            shapes.remove(new Shape(id));
        }
        ;
        Diagram diagram = new Diagram(id);

        // remove Diagram
        // (Diagram)getShapeWithId(json.getString("resourceId"), shapes);
        parseStencilSet(json,
                        diagram);
        parseSsextensions(json,
                          diagram);
        parseStencil(json,
                     diagram);
        parseProperties(json,
                        diagram,
                        keepGlossaryLink);
        parseChildShapes(shapes,
                         json,
                         diagram);
        parseBounds(json,
                    diagram);
        diagram.setShapes(shapes);
        return diagram;
    }
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;
  }
209264
public User parseArray(User user, JSONObject response) throws JSONException {
        JSONArray productArray = response.getJSONArray("products");
        user.products  = new String[productArray.length()];
        for(int i = 0; i < productArray.length(); i++) {
            user.products[i] = productArray.getString(i);
        }

        JSONArray exchangesArray = response.getJSONArray("exchanges");
        user.exchanges = new String[exchangesArray.length()];
        for (int j = 0; j < exchangesArray.length(); j++){
            user.exchanges[j] = exchangesArray.getString(j);
        }

        JSONArray orderTypeArray = response.getJSONArray("order_types");
        user.orderTypes = new String[orderTypeArray.length()];
        for(int k = 0; k < orderTypeArray.length(); k++){
            user.orderTypes[k] = orderTypeArray.getString(k);
        }

        return user;
    }
1373564
public List<T> getList(String json) throws IOException, JsonFormatException {
		JsonPullParser parser = JsonPullParser.newParser(json);
		return getList(parser, null);
	}
1030935
public void showJson(String json) {
		try {
			JsonFactory jsonFactory = new JsonFactory();
			ObjectMapper objectMapper = new ObjectMapper();
			StringWriter stringWriter = new StringWriter();

			JsonParser jsonParser = jsonFactory.createJsonParser(new StringReader(json));
			JsonNode jsonNode = objectMapper.readTree(jsonParser);
			JsonGenerator jsonGenerator = jsonFactory.createJsonGenerator(stringWriter);
			jsonGenerator.useDefaultPrettyPrinter();

			objectMapper.writeTree(jsonGenerator, jsonNode);

			jsonGenerator.flush();
			jsonGenerator.close();
		} catch (Throwable throwable) {
			// hmm, somewhat accidentally crashed?
		}
	}
1017948
@SuppressWarnings("unchecked")
    public static Map<String, Object> toMap(String json) {
        return (Map<String, Object>) JSON.parse(json);
    }
11617
def parse_json(self, page):
        ''''''
        if not isinstance(page, basestring):
            page = util.decode_page(page)
            
        self.doc = json.loads(page)
        results = self.doc.get(self.result_name, [])
    
        if not results:
            self.check_status(self.doc.get('status'))
            return None
            
            
        return results
495063
public static boolean isValid(final String json) {
        if (Strings.isEmpty(json)) {
            return false;
        }

        try {
            return parse(json) != null;
        } catch (ParseException e) {
            return false;
        }
    }
877244
def _parse(jsonOutput):
    '''
    
    '''
    parsed={}
    if not jsonOutput:
        return parsed
    
    parsed["status"] = jsonOutput[0]
    if jsonOutput[1] == None or jsonOutput[1] == "":
        return parsed
    realJson = json.loads(jsonOutput[1])

    content = ""
    for js in realJson:
        if "X-TIKA:content" in js:
            content += js["X-TIKA:content"]

    if content == "":
        content = None

    parsed["content"] = content
    parsed["metadata"] = {}

    for js in realJson:
        for n in js:
            if n != "X-TIKA:content":
                if n in parsed["metadata"]:
                    if not isinstance(parsed["metadata"][n], list):
                        parsed["metadata"][n] = [parsed["metadata"][n]]
                    parsed["metadata"][n].append(js[n])
                else:
                    parsed["metadata"][n] = js[n]

    return parsed
1132630
protected function parse_json( $json ) {

		$data = json_decode( $json, true );

		if ( ! is_array( $data ) ) {
			$data = array();
		}

		return $data;
	}