JsonParser allows streaming access to content as it arrives.
@return the JsonParser over the content (usually received from the server)
542052
@Override
  public JsonParser get() {
    if ( parser == null ) {
      if ( content == null ) {
        throw new IllegalStateException("Handle is not yet populated with content");
      }
      try {
        parser = getMapper().getFactory().createParser(content);
      } catch (JsonParseException e) {
        throw new MarkLogicIOException(e);
      } catch (IOException e) {
        throw new MarkLogicIOException(e);
      }
    }
    return parser;
  }
112184
public Stream<JsonObject> parseJsonLines(Reader r) {
        return StreamSupport.stream(Spliterators.spliteratorUnknownSize(jsonLinesIterator(r), Spliterator.ORDERED), false);
    }
1182953
public char next() throws JSONException {
        if (this.useLastChar) {
        	this.useLastChar = false;
            if (this.lastChar != 0) {
            	this.index += 1;
            }
            return this.lastChar;
        } 
        int c;
        try {
            c = this.reader.read();
        } catch (IOException exc) {
            throw new JSONException(exc);
        }

        if (c <= 0) { // End of stream
        	this.lastChar = 0;
            return 0;
        } 
    	this.index += 1;
    	this.lastChar = (char) c;
        return this.lastChar;
    }
649370
public <T> T parse(byte[] in, JsonReaderI<T> mapper) throws ParseException {
		return getPBytes().parse(in, mapper);
	}
58411
JSONObject toJson() {
        JSONObject ret = new JSONObject();
        ret.put("type",type.name());
        if (targetConfig != null) {
            ret.put("target",targetConfig.toJson());
        }
        return ret;
    }
169280
public InputStream getContent() {
        switch(contentType){
            case EMPTY:
                throw new RuntimeException("There is not Content available to analyze");
            case FILE:
                if(consumed)
                    try {
                        contentStream = Optional.of((InputStream) new FileInputStream(contentFile.get()));
                    } catch (FileNotFoundException e) {
                        throw new RuntimeException(e);
                    }
                break;
                case STRING:
                    if (consumed) {
                        if (contentEncoding.isPresent()) {
                            try {
                                contentStream = Optional.of(IOUtils.toInputStream(contentString.get(), contentEncoding.get()));
                            } catch (IOException e) {
                                throw new RuntimeException(e);
                            }
                        } else {
                            contentStream = Optional.of(IOUtils.toInputStream(contentString.get()));
                        }
                    }
                    break;
                case INPUTSTREAM:
                    if (consumed) {
                        throw new RuntimeException("The Content Stream to be analyzed has been already consumed");
                    }
                    break;
                default:
                    break;
        }
        
        consumed = true;
        return contentStream.get();
    }
574717
public ReadJSON reader() {
        Object obj = checkNotNull(this.delegate.orNull(), "The delegate object cannot be null");
        checkArgument(obj instanceof String, "The delegate object must be JSON string");
        return new ReadJSON((String) obj, this);
    }
619376
def parse(self, stream, media_type=None, parser_context=None):
        
        result = super(JSONParser, self).parse(
            stream, media_type=media_type, parser_context=parser_context
        )

        if not isinstance(result, dict) or 'data' not in result:
            raise ParseError('Received document does not contain primary data')

        data = result.get('data')
        view = parser_context['view']

        from rest_framework_json_api.views import RelationshipView
        if isinstance(view, RelationshipView):
            # We skip parsing the object as JSONAPI Resource Identifier Object and not a regular
            # Resource Object
            if isinstance(data, list):
                for resource_identifier_object in data:
                    if not (
                        resource_identifier_object.get('id') and
                        resource_identifier_object.get('type')
                    ):
                        raise ParseError(
                            'Received data contains one or more malformed JSONAPI '
                            'Resource Identifier Object(s)'
                        )
            elif not (data.get('id') and data.get('type')):
                raise ParseError('Received data is not a valid JSONAPI Resource Identifier Object')

            return data

        request = parser_context.get('request')

        # Check for inconsistencies
        if request.method in ('PUT', 'POST', 'PATCH'):
            resource_name = utils.get_resource_name(
                parser_context, expand_polymorphic_types=True)
            if isinstance(resource_name, six.string_types):
                if data.get('type') != resource_name:
                    raise exceptions.Conflict(
                        "The resource object's type ({data_type}) is not the type that "
                        "constitute the collection represented by the endpoint "
                        "({resource_type}).".format(
                            data_type=data.get('type'),
                            resource_type=resource_name))
            else:
                if data.get('type') not in resource_name:
                    raise exceptions.Conflict(
                        "The resource object's type ({data_type}) is not the type that "
                        "constitute the collection represented by the endpoint "
                        "(one of [{resource_types}]).".format(
                            data_type=data.get('type'),
                            resource_types=", ".join(resource_name)))
        if not data.get('id') and request.method in ('PATCH', 'PUT'):
            raise ParseError("The resource identifier object must contain an 'id' member")

        # Construct the return data
        serializer_class = getattr(view, 'serializer_class', None)
        parsed_data = {'id': data.get('id')} if 'id' in data else {}
        # `type` field needs to be allowed in none polymorphic serializers
        if serializer_class is not None:
            if issubclass(serializer_class, serializers.PolymorphicModelSerializer):
                parsed_data['type'] = data.get('type')
        parsed_data.update(self.parse_attributes(data))
        parsed_data.update(self.parse_relationships(data))
        parsed_data.update(self.parse_metadata(result))
        return parsed_data
900454
private Resource parseResource() throws IOException {
        //current token is ready consumed by parseResources
        if (jsonParser.getCurrentToken() != JsonToken.START_OBJECT) {
            throw new JsonParseException("Not a Resource object", jsonParser.getCurrentLocation());
        }

        Resource resource = new Resource();

        while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
            String key = jsonParser.getCurrentName();

            switch (key) {
            default:
                resource.add(key, parseDefaultValue(key));
                break;
            }
        }

        return resource;
    }
551676
public JSONObject getRawDataAsJson() throws IOException
    {
        String input = getRawDataAsString();
        if ( input == null ) {
            return null;
        }
        
        return new JSONObject(input);
    }
369045
public List<T> parseList(JsonParser jsonParser) throws IOException {
        List<T> list = new ArrayList<>();
        if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
            while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                list.add(parse(jsonParser));
            }
        }
        return list;
    }
701282
public char next() throws JSONException {
        int c;
        if (this.usePrevious) {
            this.usePrevious = false;
            c = this.previous;
        } else {
            try {
                c = this.reader.read();
            } catch (IOException exception) {
                throw new JSONException(exception);
            }
        }
        if (c <= 0) { // End of stream
            this.eof = true;
            return 0;
        }
        this.incrementIndexes(c);
        this.previous = (char) c;
        return this.previous;
    }
1257419
function Parser() {
  this.internalParser = new JsonParser();
  this.originalOnToken = this.internalParser.onToken;
  this.internalParser.onToken = onToken.bind(this);
  return this.internalParser;
}
734
public static UTF8StreamJsonParser newJsonParser(InputStream in, byte[] buf,
            int offset, int limit) throws IOException
    {
        return newJsonParser(in, buf, offset, limit, false,
                new IOContext(DEFAULT_JSON_FACTORY._getBufferRecycler(), in,
                        false));
    }
548419
public JSONObject toJSON() throws JSONException {
        JSONObject json = new JSONObject();

        json.put(JSON_TYPE, this.getType());

        return json;
    }
459701
public T parse(String jsonString) throws IOException {
        JsonParser jsonParser = LoganSquare.JSON_FACTORY.createParser(jsonString);
        jsonParser.nextToken();
        return parse(jsonParser);
    }
1071924
public JSONObject toJson() throws JSONException {
    JSONObject json = new JSONObject();

    for (OperaArgument argument : this) {
      json.put(argument.getArgument(), argument.getValue());
    }

    return json;
  }