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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:36:38+00:00 2026-06-10T12:36:38+00:00

I have this code to deserialize this json but i keep getting this error:

  • 0

I have this code to deserialize this json but i keep getting this error:

“Cannot convert object of type System.String to type
Namespace.Models.Url”

. The json structure is as below:

[ { fileUrl: “localhost/ContentManager/get/ovYWB0/81/wallpaper” }, {
fileUrl: “localhost/ContentManager/get/AcjwO0/81/wallpaper” }, {
fileUrl: “localhost/ContentManager/get/HCR0q0/81/wallpaper” }
]

The class i am mapping to is as below:

public class Url
{
    public string FileUrl { get; set; }
}

public class Response
{
    public Url FileUrl { get; set; }
}

The deserializing code is as below:

var serializer = new JavaScriptSerializer();
IList<MTContribute> data = new List<MTContribute>();

var items = serializer.Deserialize<List<Response>>(json);
foreach (var item in items)
{
    var newData = new MTContribute
    {
        DateCreated = DateTime.Today,
        IsActive = Convert.ToBoolean("True"),
        MTContributeCategoryId = Category.MTContributeCategoryId,
        Url = item.FileUrl.FileUrl
    };

    data.Add(newData);
}
  • 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-10T12:36:40+00:00Added an answer on June 10, 2026 at 12:36 pm

    According your current json structure this should work

    var items = serializer.Deserialize<List<Url>>(json); // Url instead of Response
    

    if this won’t work for you, you have to change the json structure in order to reflect the structure of Response class.

    Unless I missed something, this is the necessary json structure

    [{ fileUrl:{ fileUrl: "localhost/ContentManager/get/ovYWB0/81/wallpaper" }}]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this little piece of code, and I'm trying to convert a JSON
I have this code : void Main() { System.Timers.Timer t = new System.Timers.Timer (1000);
I have this code: ie1.link(:text, /Exception:/) It is producing an error message which I
I have this code: con.Open(); cmd = new MySqlCommand(String.Format(SELECT concat(name,'|',lastname) FROM {0} WHERE ID=
I have a Nancy JSON REST service that uses the following serialisation code... FormatterExtensions.AsJson(this.Response,
I have a problem on converting JSON string to object in Android. Here are
I have a string of JSON like this: { letterstats:[ {time_taken:636,mistake_letters:,the_letter:L,success:true}, {time_taken:216,mistake_letters:,the_letter:U,success:true}, {time_taken:103,mistake_letters:,the_letter:I,success:true} ],
I have a JSON string and I'd like to use to compose an object.
I have this code in an HTML page: alert(JSON.stringify(new Date())); I'm including the latest
I have a problem deserializing a JSON string using Jackson (but I have no

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.