Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: JSON Object parsing

  1. #1
    Junior Member
    Join Date
    May 2017
    Location
    VA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post JSON Object parsing

    I need to parse a large JSON payload which has unknown data records. I need to do some processing with each record. I cannot hold the whiole payload in memory so I need to parse it object by object between { and } and send it gson jsonReader api for further processing. I am not able to sen the whole payload to jsonReader as the Whole payload is not wellformed JSON thats why individual JSON parsing is needed. Please help.

    sample data 1st payload : [{"key":"value","key2,":"value2".....},{"key":"valu e6","key2,":"value20".....},.......},

    JsonReader parses the first payload till the end of file but throws endoffile exception at the last record(malformed json) in above example it is looking for ] instead of ','

    java.io.EOFException: End of input at line 1 column 44259740
    com.google.gson.stream.MalformedJsonException: Unexpected value at line 1 column 2747 path $

    First Payload calls the second Payload - response of which has partial json structure as :

    {"key":"value","key2,":"value2".....},{"key":"valu e6","key2,":"value20".....},.......},


    last payload json structure:

    {"key":"value","key2,":"value2".....},{"key":"valu e6","key2,":"value20".....},.......}]
    all these payload are different format therefore need to parse individual objects and then send to JSONReader object.
    How to I achieve this? Please help
    Last edited by shama786; May 26th, 2017 at 04:10 PM. Reason: forgot to mention second exception

  2. #2
    Junior Member Potato's Avatar
    Join Date
    May 2017
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: JSON Object parsing

    Hmm. You posted this under "Member Introductions"

    This section is for introducing yourself to the 'Java programming forums' community.

    Also, I just joined around 4 mins back.. so don't know for sure where to point you to post this doubt. Sorry!
    Please don't fry me. I'm just a noob in java.

  3. #3
    Junior Member
    Join Date
    May 2017
    Location
    VA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: JSON Object parsing

    Can you guide me where and how to post a question?

Similar Threads

  1. Plot a chart using Jqplot for a JSON object
    By adhithyan90 in forum Other Programming Languages
    Replies: 6
    Last Post: June 5th, 2014, 10:44 AM
  2. Exception while reading JSON object
    By swarna in forum Java Theory & Questions
    Replies: 4
    Last Post: February 21st, 2013, 12:33 AM
  3. Exception while reading JSON object
    By swarna in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 20th, 2013, 03:21 PM
  4. consume the rest service by passing the json object
    By StarRocks in forum Object Oriented Programming
    Replies: 0
    Last Post: January 29th, 2013, 06:28 AM
  5. Parsing JSON Feed
    By sogorman in forum Other Programming Languages
    Replies: 2
    Last Post: June 6th, 2011, 03:02 AM