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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:18:27+00:00 2026-05-31T05:18:27+00:00

Does anyone know how to convert a string which contains json into a C#

  • 0

Does anyone know how to convert a string which contains json into a C# array. I have this which reads the text/json from a webBrowser and stores it into a string.

string docText = webBrowser1.Document.Body.InnerText;

Just need to somehow change that json string into an array. Been looking at Json.NET but I’m not sure if that’s what I need, as I don’t want to change an array into json; but the other way around. Thanks for the help!

  • 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-31T05:18:28+00:00Added an answer on May 31, 2026 at 5:18 am

    just take the string and use the JavaScriptSerializer to deserialize it into a native object. For example, having this json:

    string json = "[{Name:'John Simith',Age:35},{Name:'Pablo Perez',Age:34}]"; 
    

    You’d need to create a C# class called, for example, Person defined as so:

    public class Person
    {
     public int Age {get;set;}
     public string Name {get;set;}
    }
    

    You can now deserialize the JSON string into an array of Person by doing:

    JavaScriptSerializer js = new JavaScriptSerializer();
    Person [] persons =  js.Deserialize<Person[]>(json);
    

    Here’s a link to JavaScriptSerializer documentation.

    Note: my code above was not tested but that’s the idea Tested it. Unless you are doing something “exotic”, you should be fine using the JavascriptSerializer.

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

Sidebar

Related Questions

Does anyone know how to convert a json string into DataTable from asp.net? I
I want to convert my Dictionary<int,List<int>> to JSON string. Does anyone know how to
Does anyone know of an easy (built in) way to convert a string like
I have a string category=45&format=1 that I want to convert into a key=value array.
Does anyone know how to convert a char array to a LPCTSTR in c?
Does anyone know how to convert a Hashtable to an XML String then back
Does anyone know of a fast way in VB to go from a string
I want to convert a string into a byte array. (Yes) I have seen
Does anyone know if there's a function in Haskell which does something like this:
Does anyone know how to convert long to short pathnames in .net 3.5 without

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.