Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Error in parsing Json file

    Dear All,
    I have a problem regarding parsing this json file, I get this error message in firefox json viewer
    "There was an error parsing the JSON document. The document may not be well-formed.
    expected property name or '}' at line 1 column 2 "

    or in JSON Editor Online - view, edit and format JSON online , this error ,

    "Error: Parse error on line 1:
    {filter_level=medium,
    -^
    Expecting 'STRING', '}', got 'undefined'"

    or in Java this error :

    "com.fasterxml.jackson.core.JsonParseException: Unexpected character ('i' (code 105)): was expecting comma to separate OBJECT entries
    at [Source: java.io.BufferedInputStream@149d893; line: 1, column: 4]
    at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1419)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:508)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:437)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:680)
    "


    this is the json file:
    Code:
    {
      filter_level=medium,
      retweeted=false,
      in_reply_to_screen_name=null,
      possibly_sensitive=false,
      truncated=false,
      lang=en,
      in_reply_to_status_id_str=null,
      id=487009017214935042,
      in_reply_to_user_id_str=null,
      in_reply_to_status_id=null,
      created_at=1404946972000,
      favorite_count=0,
      place=null,
      coordinates=null,
      retweeted_status={
        filter_level=low,
        contributors=null,
        text=Welldoneboys.Wehadagoodrun#WorldCup2014#NED#nicetrycillessenhttp: //t.co/YGk2KykOsx,
        geo=null,
        retweeted=false,
        in_reply_to_screen_name=null,
        possibly_sensitive=false,
        truncated=false,
        lang=en,
        entities={
          trends=[
            
          ],
          hashtags=[
            {
              indices=[
                34,
                47
              ],
              text=WorldCup2014
            },
            {
              indices=[
                48,
                52
              ],
              text=NED
            },
            {
              indices=[
                53,
                70
              ],
              text=nicetrycillessen
            }
          ],
          symbols=[
            
          ],
          urls=[
            {
              expanded_url=http: //instagram.com/p/qP22l7MMfP/,
              indices=[
                71,
                93
              ],
              display_url=instagram.com/p/qP22l7MMfP/,
              url=http: //t.co/YGk2KykOsx
            }
          ],
          user_mentions=[
            
          ]
        },
        in_reply_to_status_id_str=null,
        id=487006659882274816,
        source=<ahref="http://instagram.com"rel="nofollow">Instagram</a>,
        in_reply_to_user_id_str=null,
        favorited=false,
        in_reply_to_status_id=null,
        retweet_count=1,
        created_at=1404946410000,
        in_reply_to_user_id=null,
        favorite_count=0,
        id_str=487006659882274816,
        place=null,
        user={
          location=,
          default_profile=true,
          profile_background_tile=false,
          statuses_count=117,
          lang=en,
          profile_link_color=0084B4,
          profile_banner_url=https: //pbs.twimg.com/profile_banners/1966277912/1381994823,
          id=1966277912,
          following=null,
          protected=false,
          favourites_count=19,
          profile_text_color=333333,
          verified=false,
          description=FollowerofJesusChrist•Husband•DancerofRefined/Undignified•ADutchUkranianNewfielivinginCanada,
          contributors_enabled=false,
          profile_sidebar_border_color=C0DEED,
          name=JesseGullage,
          profile_background_color=C0DEED,
          created_at=1381994267000,
          default_profile_image=false,
          followers_count=16,
          profile_image_url_https=https: //pbs.twimg.com/profile_images/483797312645259264/DPkh2LxK_normal.jpeg,
          geo_enabled=false,
          profile_background_image_url=http: //abs.twimg.com/images/themes/theme1/bg.png,
          profile_background_image_url_https=https: //abs.twimg.com/images/themes/theme1/bg.png,
          follow_request_sent=null,
          url=null,
          utc_offset=null,
          time_zone=null,
          notifications=null,
          profile_use_background_image=true,
          friends_count=40,
          profile_sidebar_fill_color=DDEEF6,
          screen_name=J_Gullage,
          id_str=1966277912,
          profile_image_url=http: //pbs.twimg.com/profile_images/483797312645259264/DPkh2LxK_normal.jpeg,
          listed_count=0,
          is_translator=false
        },
        coordinates=null
      },
      contributors=null,
      text=RT@J_Gullage: Welldoneboys.Wehadagoodrun#WorldCup2014#NED#nicetrycillessenhttp: //t.co/YGk2KykOsx,
      geo=null,
      entities={
        trends=[
          
        ],
        hashtags=[
          {
            indices=[
              49,
              62
            ],
            text=WorldCup2014
          },
          {
            indices=[
              63,
              67
            ],
            text=NED
          },
          {
            indices=[
              68,
              85
            ],
            text=nicetrycillessen
          }
        ],
        symbols=[
          
        ],
        urls=[
          {
            expanded_url=http: //instagram.com/p/qP22l7MMfP/,
            indices=[
              86,
              108
            ],
            display_url=instagram.com/p/qP22l7MMfP/,
            url=http: //t.co/YGk2KykOsx
          }
        ],
        user_mentions=[
          {
            id=1966277912,
            indices=[
              3,
              13
            ],
            screen_name=J_Gullage,
            id_str=1966277912,
            name=JesseGullage
          }
        ]
      },
      source=<ahref="http://twitter.com/download/android"rel="nofollow">TwitterforAndroid</a>,
      favorited=false,
      retweet_count=0,
      in_reply_to_user_id=null,
      id_str=487009017214935042,
      user={
        location=Vancouver,
        Canada,
        default_profile=false,
        profile_background_tile=false,
        statuses_count=3187,
        lang=en,
        profile_link_color=0084B4,
        profile_banner_url=https: //pbs.twimg.com/profile_banners/283917731/1375734428,
        id=283917731,
        following=null,
        protected=false,
        favourites_count=33,
        profile_text_color=333333,
        verified=false,
        description=followerofChrist|21|cdn|cityboy|naturelover|traveler|writer|dancinguponinjustice.,
        contributors_enabled=false,
        profile_sidebar_border_color=A8C7F7,
        name=MatthewNewton,
        profile_background_color=022330,
        created_at=1303114355000,
        default_profile_image=false,
        followers_count=139,
        profile_image_url_https=https: //pbs.twimg.com/profile_images/378800000253260766/e97c76a6b4f5113bfb58146c2d7cd49c_normal.jpeg,
        geo_enabled=true,
        profile_background_image_url=http: //abs.twimg.com/images/themes/theme15/bg.png,
        profile_background_image_url_https=https: //abs.twimg.com/images/themes/theme15/bg.png,
        follow_request_sent=null,
        url=http: //www.matthewinministry.tumblr.com,
        utc_offset=-21600,
        time_zone=Saskatchewan,
        notifications=null,
        profile_use_background_image=true,
        friends_count=164,
        profile_sidebar_fill_color=C0DFEC,
        screen_name=matthewcasper,
        id_str=283917731,
        profile_image_url=http: //pbs.twimg.com/profile_images/378800000253260766/e97c76a6b4f5113bfb58146c2d7cd49c_normal.jpeg,
        listed_count=5,
        is_translator=false
      }
    }

    Thank you in advance.

  • #2
    New Coder
    Join Date
    Aug 2014
    Posts
    20
    Thanks
    0
    Thanked 1 Time in 1 Post
    That's not a valid JSON file.
    First of all the key-value pairs have to be separated by a colon.
    Second the keys and values have to be enclosed in double quotes.
    You can read more about the JSON syntax at this W3 Schools page - JSON Syntax and see an example of a properly encoded file at JSON Schema Examples


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •