Click here to Skip to main content
15,886,724 members
Home / Discussions / C#
   

C#

 
QuestionMessageBoxManager .dll using Pin
ormonds27-Dec-17 20:59
ormonds27-Dec-17 20:59 
AnswerRe: MessageBoxManager .dll using Pin
Pete O'Hanlon27-Dec-17 22:02
mvePete O'Hanlon27-Dec-17 22:02 
AnswerRe: MessageBoxManager .dll using Pin
ormonds28-Dec-17 9:56
ormonds28-Dec-17 9:56 
GeneralRe: MessageBoxManager .dll using Pin
BillWoodruff29-Dec-17 14:51
professionalBillWoodruff29-Dec-17 14:51 
AnswerRe: MessageBoxManager .dll using Pin
BillWoodruff29-Dec-17 14:56
professionalBillWoodruff29-Dec-17 14:56 
QuestionIssue while parsing HTML string in C# Pin
Mateen1127-Dec-17 18:59
Mateen1127-Dec-17 18:59 
AnswerRe: Issue while parsing HTML string in C# Pin
OriginalGriff27-Dec-17 20:05
mveOriginalGriff27-Dec-17 20:05 
QuestionExtracting a node from Json File in C# Pin
Sandeep Vemulapalli27-Dec-17 11:10
Sandeep Vemulapalli27-Dec-17 11:10 
Hey Guys,

Hope you guys are doing great! I have one question kind of stuck there. In the JSON File, I would like to extract the data from the node. Say like I wanted to extract the book node or value which is within goods node. Here is my JSON file.
{"store": [
{
    "name": "Sunshine Department Store",
    "address": "Wangfujing Street",
    "goods": {
        "book": [
            {
                "category": "Reference",
                "title": "Sayings of the Century",
                "author": "Nigel Rees",
                "price": 8.88
            },
            {
                "category": "Fiction",
                "title": "Sword of Honour",
                "author": "Evelyn Waugh",
                "price": 12.66
            }
        ],
        "bicycle": {
            "type": "GIANT OCR2600",
            "color": "White",
            "price": 276
        }
    }
}
]
}

Here is my code
private string ParseBookNode(JObject bookJSONFile)
        {
            JArray bookJson = null;
            string bookFarmNode = null;
            if (bookJSONFile != null && bookJSONFile["store"] != null)
            {
                bookJson = (JArray)bookJSONFile["store"];
                bookFarmNode = bookJson[0].ToString();

                if (bookJSONFile["book"] != null)
                {
                    bookJson = (JArray)bookJSONFile["book"];
                    bookFarmNode = bookJson[0].ToString();
                }
            }
            else
            {
                throw new Exception("Book node not found.");
            }
            return bookFarmNode;
        }

How I can able to extract data along this lines??
if (bookJSONFile["book"] != null)
                {
                    bookJson = (JArray)bookJSONFile["book"];
                    bookFarmNode = bookJson[0].ToString();
                }

AnswerRe: Extracting a node from Json File in C# Pin
Nathan Minier28-Dec-17 1:52
professionalNathan Minier28-Dec-17 1:52 
QuestionC # + Regex help (for a newbie) Pin
Damian Bz27-Dec-17 4:16
Damian Bz27-Dec-17 4:16 
AnswerRe: C # + Regex help (for a newbie) Pin
OriginalGriff27-Dec-17 5:00
mveOriginalGriff27-Dec-17 5:00 
GeneralRe: C # + Regex help (for a newbie) Pin
Nathan Minier27-Dec-17 6:10
professionalNathan Minier27-Dec-17 6:10 
GeneralRe: C # + Regex help (for a newbie) Pin
OriginalGriff27-Dec-17 6:23
mveOriginalGriff27-Dec-17 6:23 
GeneralRe: C # + Regex help (for a newbie) Pin
Nathan Minier27-Dec-17 6:34
professionalNathan Minier27-Dec-17 6:34 
GeneralRe: C # + Regex help (for a newbie) Pin
OriginalGriff27-Dec-17 6:40
mveOriginalGriff27-Dec-17 6:40 
GeneralRe: C # + Regex help (for a newbie) Pin
Nathan Minier27-Dec-17 6:56
professionalNathan Minier27-Dec-17 6:56 
GeneralRe: C # + Regex help (for a newbie) Pin
Damian Bz27-Dec-17 6:24
Damian Bz27-Dec-17 6:24 
GeneralRe: C # + Regex help (for a newbie) Pin
OriginalGriff27-Dec-17 6:28
mveOriginalGriff27-Dec-17 6:28 
GeneralRe: C # + Regex help (for a newbie) Pin
Damian Bz27-Dec-17 6:18
Damian Bz27-Dec-17 6:18 
GeneralRe: C # + Regex help (for a newbie) Pin
OriginalGriff27-Dec-17 6:26
mveOriginalGriff27-Dec-17 6:26 
GeneralRe: C # + Regex help (for a newbie) Pin
Damian Bz27-Dec-17 6:29
Damian Bz27-Dec-17 6:29 
GeneralRe: C # + Regex help (for a newbie) Pin
Damian Bz27-Dec-17 7:37
Damian Bz27-Dec-17 7:37 
GeneralRe: C # + Regex help (for a newbie) Pin
Damian Bz27-Dec-17 9:15
Damian Bz27-Dec-17 9:15 
GeneralRe: C # + Regex help (for a newbie) Pin
Richard MacCutchan27-Dec-17 21:56
mveRichard MacCutchan27-Dec-17 21:56 
GeneralRe: C # + Regex help (for a newbie) Pin
OriginalGriff28-Dec-17 1:51
mveOriginalGriff28-Dec-17 1:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.