Package org.codehaus.jackson

Examples of org.codehaus.jackson.JsonFactory.createJsonParser()


    }

    public static JsonParser createJsonParser(InputStream content) {
        JsonFactory jsonFactory = getJsonFactory();
        try {
            return jsonFactory.createJsonParser(content);
        } catch (IOException e) {
            throw new IllegalArgumentException(e);
        }
    }
View Full Code Here


    }

    public static JsonParser createJsonParser(Reader content) {
        JsonFactory jsonFactory = getJsonFactory();
        try {
            return jsonFactory.createJsonParser(content);
        } catch (IOException e) {
            throw new IllegalArgumentException(e);
        }
    }
View Full Code Here

    private int depth;
    private BufferingInputOutputStream buffers;

    public JsonRootEatingInputStreamFilter(InputStream inputStream) throws IOException {
        JsonFactory jsonFactory = new JsonFactory();
        this.jsonParser = jsonFactory.createJsonParser(inputStream);
        this.buffers = new BufferingInputOutputStream();
        this.jsonGenerator = jsonFactory.createJsonGenerator(this.buffers, JsonEncoding.UTF8);
        this.depth = 0;
    }
View Full Code Here

        _testJsonExpr("[\"one\",2,\"3\"]");
    }

    public void _testJsonExpr(String expr) throws Exception {
        JsonFactory factory = new JsonFactory();
        JsonParser p = factory.createJsonParser(expr);
        JsonParser rap = JacksonRootAddingParser.createRootAddingParser(p, "root");
        StringWriter sw = new StringWriter();
        JsonGenerator g = factory.createJsonGenerator(sw);
        rap.nextToken();
        while (rap.hasCurrentToken()) {
View Full Code Here

    private Map<String, String> parseJSON(String jsonmessage){
        Map<String, String> parsed = new HashMap<String, String>();
        JsonFactory jf = new JsonFactory();
        try {
            JsonParser parser = jf.createJsonParser(jsonmessage);
            parser.nextToken(); //shift past the START_OBJECT that begins the JSON
            while (parser.nextToken() != JsonToken.END_OBJECT) {
                String fieldname = parser.getCurrentName();
                parser.nextToken(); // move to value, or START_OBJECT/START_ARRAY
                String value = parser.getText();
View Full Code Here

    if (ApitraryOrmConfiguration.showJson()) {
      showJson(json);
    }

    JsonFactory f = new JsonFactory();
    JsonParser jp = f.createJsonParser(json);

    JsonToken token = jp.nextToken();
    String fieldName = jp.getCurrentName();
    while (!(token == null && fieldName == null)) {
      on(token, fieldName, jp);
View Full Code Here

    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);
View Full Code Here

    ));
    final Set<String> multiples = new HashSet<String>(Arrays.asList(
            "ZADD"
    ));
    JsonFactory jf = new MappingJsonFactory();
    JsonParser jsonParser = jf.createJsonParser(new URL("https://raw.github.com/antirez/redis-doc/master/commands.json"));
    final JsonNode commandNodes = jsonParser.readValueAsTree();
    Iterator<String> fieldNames = commandNodes.getFieldNames();
    ImmutableListMultimap<String,String> group = Multimaps.index(fieldNames,
            new Function<String, String>() {
              @Override
View Full Code Here

  @Nonnull
  @Override
  public T deserialize( @Nonnull InputStream in ) throws IOException, VersionException {
    try {
      JsonFactory jsonFactory = JacksonSupport.getJsonFactory();
      JsonParser parser = jsonFactory.createJsonParser( in );

      T deserialized = deserialize( parser );

      ensureParserClosed( parser );
      return deserialized;
View Full Code Here

      throws JsonParseException, IOException {
 
      this.depth = depth;
      byte[] in = input.getBytes("UTF-8");
      JsonFactory f = new JsonFactory();
      JsonParser p = f.createJsonParser(
          new ByteArrayInputStream(input.getBytes("UTF-8")));
     
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      Encoder cos = new BlockingBinaryEncoder(os, bufferSize);
      serialize(cos, p, os);
View Full Code Here

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.