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 7525063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:26:09+00:00 2026-05-30T03:26:09+00:00

Below is my returned json from twitter { created_at: Sat, 11 Feb 2012 06:38:28

  • 0

Below is my returned json from twitter

{
"created_at": "Sat, 11 Feb 2012 06:38:28 +0000",
"entities": {
  "hashtags": [
    {
      "text": "Shubhdin",
      "indices": [
        9,
        18
      ]
    }
  ],
  "urls": [],
  "user_mentions": [
    {
      "screen_name": "SAMdLaw",
      "name": "Sabyasachi Mohapatra",
      "id": 104420398,
      "id_str": "104420398",
      "indices": [
        0,
        8
      ]
    }
  ]
},
"from_user": "nilayshah80",
"from_user_id": 213599118,
"from_user_id_str": "213599118",
"from_user_name": "Nilay Shah",
"geo": {
  "coordinates": [
    18.6003,
    73.825
  ],
  "type": "Point"
},
"id": 168222351106899968,
"id_str": "168222351106899968",
"iso_language_code": "in",
"metadata": {
  "result_type": "recent"
},
"profile_image_url": "http://a2.twimg.com/profile_images/1528184590/IMG_0465_normal.JPG",
"profile_image_url_https": "https://si0.twimg.com/profile_images/1528184590/IMG_0465_normal.JPG",
"source": "<a href="http://twabbit.wordpress.com/" rel="nofollow">twabbit</a>",
"text": "@SAMdLaw #Shubhdin mitra",
"to_user": "SAMdLaw",
"to_user_id": 104420398,
"to_user_id_str": "104420398",
"to_user_name": "Sabyasachi Mohapatra",
"in_reply_to_status_id": 168219865197461505,
"in_reply_to_status_id_str": "168219865197461505"
},
{
"created_at": "Sun, 12 Feb 2012 01:54:07 +0000",
"entities": {
  "hashtags": [
    {
      "text": "IWIllAlwaysLoveYou",
      "indices": [
        88,
        107
      ]
    }
  ],
  "urls": [],
  "user_mentions": [],
  "media": [
    {
      "id": 168513175187238912,
      "id_str": "168513175187238912",
      "indices": [
        108,
        128
      ],
      "media_url": "http://p.twimg.com/Alat1wsCMAAh-wE.jpg",
      "media_url_https": "https://p.twimg.com/Alat1wsCMAAh-wE.jpg",
      "url": "http://shortener.twitter.com/dRc4dXH3",
      "display_url": "pic.twitter.com/dRc4dXH3",
      "expanded_url": "http://twitter.com/RIPWhitneyH/status/168513175183044608/photo/1",
      "type": "photo",
      "sizes": {
        "orig": {
          "w": 395,
          "h": 594,
          "resize": "fit"
        },
        "large": {
          "w": 395,
          "h": 594,
          "resize": "fit"
        },
        "thumb": {
          "w": 150,
          "h": 150,
          "resize": "crop"
        },
        "small": {
          "w": 340,
          "h": 511,
          "resize": "fit"
        },
        "medium": {
          "w": 395,
          "h": 594,
          "resize": "fit"
        }
      }
    }
  ]
},
"from_user": "RIPWhitneyH",
"from_user_id": 19319043,
"from_user_id_str": "19319043",
"from_user_name": "RIP Whitney Houston",
"geo": null,
"id": 168513175183044608,
"id_str": "168513175183044608",
"iso_language_code": "en",
"metadata": {
  "recent_retweets": 8,
  "result_type": "popular"
},
"profile_image_url": "http://a2.twimg.com/profile_images/1820957590/images__13__normal.jpg",
"profile_image_url_https": "https://si0.twimg.com/profile_images/1820957590/images__13__normal.jpg",
"source": "<a href="http://twitter.com/">web</a>",
"text": "R-T if you think that the Grammy's should organize an \"R.I.P. Whitney Houston\" tribute. #IWIllAlwaysLoveYou http://shortener.twitter.com/dRc4dXH3",
"to_user": null,
"to_user_id": null,
"to_user_id_str": null,
"to_user_name": null
},

If you noticed Media under entities not available in above 2 and when i tried to call below snippet gives me null reference error

 MediaUrl = (from user in tweet["entities"]["media"]
 select new mediaUrl
 {
      shortUrl = (string)user["url"],
      longUrl = (string)user["expanded_url"],
      url = (string)user["media_url"],
      start = user["indices"][0].ToString(),
      end = user["indices"][1].ToString(),
      mediaType = (string)user["type"],
  }).ToList()

Same code work for Entities/URL, Hashtags and mentions but not for Media.

Also tried this -> Get JSON object node but still getting null reference exception.

  • 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-30T03:26:11+00:00Added an answer on May 30, 2026 at 3:26 am

    Finally got working. Not appropriate solution but works for me.

    I created separate method for parsing Media. Passed Entity as string and in that method i checked is EntityString.Contains Media or not. If yes, then parse media json else returned null. See below Snippet.

            if (Entities != string.Empty)
            {
                if (Entities.Contains("\"media\":"))
                {
                    JObject searchResult = JObject.Parse(Entities);
                    returnMedia = (from user in searchResult["media"]
                                   select new mediaUrl
                                   {
                                       shortUrl = (string)user["url"],
                                       longUrl = (string)user["expanded_url"],
                                       url = (string)user["media_url"],
                                       start = user["indices"][0].ToString(),
                                       end = user["indices"][1].ToString(),
                                       mediaType = (string)user["type"],
                                   }).ToList();
                }
            }
    

    This works for me. If you have any better solution then Please let me know.

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

Sidebar

Related Questions

I have the below JSON returned from a DB. How do I refer to
The json data object below is what's returned from a custom Google search API
I have a page (below) that has a datagrid that lists item's returned from
I am getting a JSON object from a webMethod by the call below and
I need to convert a string to a JSON object that gets returned from
I have the following JSON date returned from a MVC page e.g. DateProcessed:\/Date(1258125238090)\/ and
I am using RESTKIT to map the JSON returned from server. The JSON result
When running the below code a type is never returned, despite there being a
Below are lines from the c++ programming language template<class T > T sqrt(T );
I’m new to android,I have an activity class which fetches Json string from url

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.