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

  • Home
  • SEARCH
  • 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 8944149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:57:36+00:00 2026-06-15T11:57:36+00:00

I’m very new to working with JSON and am dealing wtih a return from

  • 0

I’m very new to working with JSON and am dealing wtih a return from an API which I can’t change the formatting of. The return example is : (actual urls have been removed)

{
"body":
    {
    "link":
        {"linkurl": ["www.google.com"]}
    },
"error": null,
"message": "Data Retrieved successfully",
"status": true
}

I am using the Newtonsoft.Json library with MVC 3, in VS2010.

My class is:

[JsonObject(MemberSerialization.OptIn)]
    public class LinksJSON
    {
        [JsonProperty]
        public string link{ get; set; }

        [JsonProperty]
        public string message { get; set; }

        [JsonProperty]
        public string error { get; set; }

        [JsonProperty]
        public bool status { get; set; }
    }

I’m deserializing it with :

private static T _download_serialized_json_data<T>(string url) where T : new()
    {
        using (var w = new WebClient())
        {
            var json_data = string.Empty;
            // attempt to download JSON data as a string
            try
            {
                json_data = w.DownloadString(url);
            }
            catch (Exception) { }
            // if string with JSON data is not empty, deserialize it to class and return its instance 
            return !string.IsNullOrEmpty(json_data) ? JsonConvert.DeserializeObject<T>(json_data) : new T();
        }
    }

    public string CheckJSONLink()
    {

        var url = "<api url-removed for security>";

        var outObj = _download_serialized_json_data<LinksJSON>(url);



        return outObj.Link;
    }

However I’m trying to get the value of linkurl, which is an indexed array within Link.

How would I access this information?

  • 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-06-15T11:57:36+00:00Added an answer on June 15, 2026 at 11:57 am

    You should use the following classes:

    [JsonObject(MemberSerialization.OptIn)]
    public class LinksJSON
    {
        [JsonProperty]
        public body body { get; set; }
    
        [JsonProperty]
        public string message { get; set; }
    
        [JsonProperty]
        public string error { get; set; }
    
        [JsonProperty]
        public bool status { get; set; }
    }
    
    [JsonObject(MemberSerialization.OptIn)]
    public class body
    {
        [JsonProperty]
        public link link { get; set; }
    }
    
    [JsonObject(MemberSerialization.OptIn)]
    public class link
    {
        [JsonProperty]
        public string[] linkurl { get; set; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I am using jsonparser to parse data and images obtained from json response. When
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I want use html5's new tag to play a wav file (currently only supported

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.