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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:54:08+00:00 2026-05-26T21:54:08+00:00

I am using post method in that method i want to pass entire Json

  • 0

I am using post method in that method i want to pass entire Json in string like this way

{Data:” JsonArray”} in Jssonarray I want to pass this value

{   "version" : 2,
"query" : "Companies, CA",
"begin" : 1,
"end" : 3,
"totalResults" : 718,
"pageNumber" : 0,

"results" : [ 
      { "company" : "ABC Company Inc.",  "city" : "Sacramento",  "state" : "CA" } ,
      { "company" : "XYZ Company Inc.",  "city" : "San Francisco",  "state" : "CA" } ,
      { "company" : "KLM Company Inc.",  "city" : "Los Angeles",  "state" : "CA" } 
]
}

When i pass this I am getting 500 internal Error
Please help me how to pass Entire Json in a single string.

  • 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-26T21:54:08+00:00Added an answer on May 26, 2026 at 9:54 pm

    One way is to navigate to http://json2csharp.com/, paste your Json and hit “GO”.

    The result will be this one (I fixed the capitalization):

    public class Result {
        public string Company { get; set; }
        public string City { get; set; }
        public string State { get; set; }
    }
    
    public class RootObject {
        public int Version { get; set; }
        public string Query { get; set; }
        public int Begin { get; set; }
        public int End { get; set; }
        public int TotalResults { get; set; }
        public int PageNumber { get; set; }
        public Result[] Results { get; set; }
    }
    

    Paste this into your application.

    Your POST-Method then could look like this:

    [WebInvoke(Method = "POST", UriTemplate = "")]
    public HttpResponseMessage Add(RootObject root) {
    
        // do something with your root objects or its child objects...
    
        return new HttpResponseMessage(HttpStatusCode.Created);
    }
    

    And you’re done with this method.

    Another method is to use the new JsonValue and JsonArray introduced with Web API whereas you don’t need RootObject and Result.

    Just use your POST-Method:

    [WebInvoke(Method = "POST", UriTemplate = "")]
    public HttpResponseMessage Add(JsonValue json) {
        JsonArray arr = (JsonArray) json["results"];
        JsonValue result1 = arr[0];
        var company = result1["company"]; // results in "ABC Company Inc."
        return new HttpResponseMessage(HttpStatusCode.Created);
    }
    

    You should get a clue…

    You can prettify the whole thing:

    [WebInvoke(Method = "POST", UriTemplate = "")]
    public HttpResponseMessage Add(JsonValue json) {
        var arr = json["results"];
        var result1 = arr[0];
        var company = result1["company"]; // results in "ABC Company Inc."
        return new HttpResponseMessage(HttpStatusCode.Created);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

header(Location:post.php?id=120); This is the method which i am using now to pass values between
$.ajax({ url: /cgi-bin/stats.exe, method: post, async: false, data: { refresh: a41 } }); Using
I have a xml string that return from Post method: private static void GetResponseCallback(IAsyncResult
I am getting the following error, using jQuery POST method in Firefox. Could not
I'm submitting a form using an ajax request (POST method), and checking the HTTP
How to send an http request with either post/get method using javascript as an
I am using form_tag <%= form_tag url_for(:action=>'url'), :onclick=> $('.submit_btn').addClass('disabled');, :complete=>$(.submit_btn).removeClass(disabled), :method=>post, :remote =>true do
Just started with JQuery and I've managed to pass a parameter using POST, firebug
I used this example (http://reecon.wordpress.com/2010/04/25/uploading-files-to-http-server-using-post-android-sdk/) to upload file from android device to server, it
when using http post with flash that send ip address request from client computer

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.