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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:40:19+00:00 2026-06-11T22:40:19+00:00

suppose my json stored in string variable. my json look like {\file\:\dave\,\type\:\ward\} the above

  • 0

suppose my json stored in string variable. my json look like

"{\"file\":\"dave\",\"type\":\"ward\"}"

the above data stored like in my string variable. now how can i deserialize this json data and read each component like file and type.

i tried with the below code but getting error

 var jss = new JavaScriptSerializer();
 string json = new StreamReader(context.Request.InputStream).ReadToEnd();

 var sData=jss.Deserialize<string>(json);
 string _file = sData[0].ToString();
 string _type = sData[1].ToString();

please guide my how can i extract each component like file and type after deserialize this from data in json format. thanks


Rectification

This way i solve this….here is whole client side & server side code.

     <script type="text/javascript">
     $(document).ready(function () {
         $('#btnlogin').click(function (e) {
             var FeedCrd = {};
             FeedCrd["file"] = 'dave';
             FeedCrd["type"] = 'ward';

             $.ajax({
                 type: "POST",
                 url: "CallASHX.ashx",
                 data: JSON.stringify(FeedCrd),
                 //data: { 'file': 'dave', 'type': 'ward' },
                 //dataType: "json",
                 success: function (data) {
                     if (data == "SUCCESS");
                     {
                         alert('SUCCESS');
                     }

                 },
                 error: function (XMLHttpRequest, textStatus, errorThrown) {
                     alert(textStatus);
                 }

             });
             return false;
         });
     });
 </script>

public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/html";
        var jss = new JavaScriptSerializer();
        string json = new StreamReader(context.Request.InputStream).ReadToEnd();
        Dictionary<string,string> sData=jss.Deserialize<Dictionary<string,string>>(json);
        string _file = sData["file"].ToString();
        string _type = sData["type"].ToString();
        context.Response.Write("SUCCESS");
    }
  • 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-11T22:40:20+00:00Added an answer on June 11, 2026 at 10:40 pm

    Easiest way I have found is combining the Json.NET library with the new .net dynamic object type:

    string json = "{\"file\":\"dave\",\"type\":\"ward\"}";
    dynamic jo = JObject.Parse(json);
    string _file = jo.file;
    string _type = jo.type;
    

    Don’t forget:

    using Newtonsoft.Json.Linq;
    

    This is a very simple way where you don’t have to declare a strongly-typed object, therefore its simple to do on the fly.

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

Sidebar

Related Questions

Suppose your JSON data has a key like @id ... with a non-alphanum character...
Suppose you are working with some data, which comes from a JSON file. You
Suppose I have a json string like this: { ... key1:value1; ... } with
I'm implementing an API. The API accepts/returns JSON content type. Now, suppose that the
Suppose you have some complex JSON like: {A : valA, B : { C
I have a huge JSON file to parse in my Android app. I suppose
Suppose I have a url like: http://example.com/get-users which returns a JSON object of all
Can you share your thoughts how would you implement data versioning in Cassandra. Suppose
Suppose I have two json files. I would like to be able to load
Suppose I am using Google's Gson library to parse JSON into Java data structures.

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.