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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:05:49+00:00 2026-06-16T02:05:49+00:00

I am using Newtonsoft.Json for parsing Json text. For a reason I need name

  • 0

I am using Newtonsoft.Json for parsing Json text. For a reason I need name of JToken or Jvalue object. As per example if “ChoiceId”:865 is JValue then I need to get “ChoiceId”. But I am trying it for few hours now but could not figure out how. How can I get that name ?

Thanks

EXAMPLE:
if this is the json file content:

{"ChoiceId":868,"Choice":"Post","Url":"/pst/goods"}

Then I can get ChoiceId value by using

JObject json = JObject.Parse(hole);
JValue jvalue = (Jvalue)json["ChoiceId"];
string value = jvalue.Value;

But there is no property for getting the name ie.”ChoiceId” . So my question is that how can I get it ?

  • 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-16T02:05:50+00:00Added an answer on June 16, 2026 at 2:05 am

    As I’ve seen none of your code thus I’m spitballing, perhaps you’re looking for JToken.Parent and JProperty?

    // Assumes token is JToken, search for the owning JProperty
    var parentProperty = token.Ancestors<JProperty>()
                              .FirstOrDefault();
    
    // alternatively, if you know it'll be a property:
    var parentProperty = ((JProperty)token.Parent);
    
    var name = parentProperty.Name;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've serialized an object using Newtonsoft's JSON serializer, and the DateTime has come through
I am using Newtonsoft.Json to Deserialize json string to Object, but I can't judge
I am using NewtonSoft Json.NET library for parsing JSON files in a .NET app.
using System; using System.Collections.Generic; using Newtonsoft.Json; using System.Text; using System.IO; using System.Runtime.Serialization; using Newtonsoft.Json.Serialization;
Parsing Google Plus JSON objects Using C# and Newtonsoft.Json library how one can parse
Using the Newtonsoft.Json library, imagine I have got public class Test { public Object
Please see: using System; using System.Collections.Generic; using System.Linq; using System.Text; using Newtonsoft.Json; using Newtonsoft.Json.Converters;
I'm using Newtonsoft JSON.NET 4.5r7 in an MVC4 non-api project. Below I rename id
Currently I am using the terrific Linq 2 Json.net (by newtonsoft), which is a
I am trying to populate a C# object (ImportedProductCodesContainer) with data using JSON.NET deserialization.

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.