Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7077525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:26:03+00:00 2026-05-28T06:26:03+00:00

I am parsing json object from facebook. In my facebook json object, there are

  • 0

I am parsing json object from facebook.
In my facebook json object, there are string keys inside key array “data”.

My Code as follows,

"data": [
  {
     "id": "100001211447563_300696056647440",
     "from": {
        "name": "Seho Lee",
        "id": "100001211447563"
     },
     "story": "Seho Lee is now using Facebook in English (US).",
     "story_tags": {
        "0": [
           {
              "id": 100001211447563,
              "name": "Seho Lee",
              "offset": 0,
              "length": 8
           }
        ]
     },
     "type": "status",
     "created_time": "2012-01-19T09:13:04+0000",
     "updated_time": "2012-01-19T09:13:04+0000",
     "comments": {
        "count": 0
     }
  },
  {
     "id": "100001211447563_298802933503419",
     "from": {
        "name": "Seho Lee",
        "id": "100001211447563"
     },
     "story": "Seho Lee started using Graph API Explorer.",
     "story_tags": {
        "23": [
           {
              "id": 145634995501895,
              "name": "Graph API Explorer",
              "offset": 23,
              "length": 18
           }
        ],
        "0": [
           {
              "id": 100001211447563,
              "name": "Seho Lee",
              "offset": 0,
              "length": 8
           }
        ]
     },
     "picture": "http://photos-a.ak.fbcdn.net/photos-ak-snc1/v43/11/145634995501895/app_1_145634995501895_4870.gif",
     "link": "http://developers.facebook.com/tools/explorer/",
     "caption": "A tool to help you browse objects within the Facebook Graph API, manage permissions, obtain access tokens and generally learn how it all works.",
     "actions": [
        {
           "name": "Comment",
           "link": "http://www.facebook.com/100001211447563/posts/298802933503419"
        },
        {
           "name": "Like",
           "link": "http://www.facebook.com/100001211447563/posts/298802933503419"
        }
     ],
     "type": "link",
     "created_time": "2012-01-16T09:47:57+0000",
     "updated_time": "2012-01-16T09:47:57+0000",
     "comments": {
        "count": 0
     }
  },
  {
     "id": "100001211447563_298789650171414",
     "from": {
        "name": "Seho Lee",
        "id": "100001211447563"
     },
     "story": "Seho Lee likes myFBCovers.com.",
     "story_tags": {
        "15": [
           {
              "id": 160901873998019,
              "name": "myFBCovers.com",
              "offset": 15,
              "length": 14
           }
        ],
        "0": [
           {
              "id": 100001211447563,
              "name": "Seho Lee",
              "offset": 0,
              "length": 8
           }
        ]
     },
     "type": "status",
     "created_time": "2012-01-16T08:57:33+0000",
     "updated_time": "2012-01-16T08:57:33+0000",
     "comments": {
        "count": 0
     }
  }

when I parsing this json object, String key “likes” is sometimes exist and sometimes do not exist in “data” jsonArray. So when I parsing JsonString “likes”, sometimes I gets JSONException since I am parsing null value. Is there any way to skipping “null” json value?

Please help me regarding this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:26:03+00:00Added an answer on May 28, 2026 at 6:26 am

    Edit: this is to check key. since you mentioned key exists sometimes. did you mean the value?

    use JSONObjects method has(key)

    data = (JSONObject) new JSONTokener(jsonObjRecv.toString()).nextValue();
    if data.has("like"){
    ...
    }
    

    to check whether the value is null check with isNull(“name”)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From a previous question on Stackoverflow Iterating through/Parsing JSON Object via JavaScript .... My
I'm having difficulty parsing some JSON data returned from my server using jQuery.ajax() To
I'm parsing data with JSON from my server database, but the presentation in my
I'm parsing a JSON object (from YQL) that includes some null values, like this:
I'm grabbing JSON object from an URL and parsing it with JSON.NET. I was
I started getting errors in my browser, parsing JSON return data from the server.
I'm parsing a JSON response via $.ajax() and building a form from this object's
I'm work with GWT and parsing a JSON result from an ASP.NET webservice method
Am am successfully parsing and sending JSON values from my client for my server
I am currently trying to pass a generated JSON string to dojo for parsing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.