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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:07:11+00:00 2026-05-11T15:07:11+00:00

In response to a question I asked a few days ago, I’m attempting to

  • 0

In response to a question I asked a few days ago, I’m attempting to stretch myself a little, and do something that I’ve not really focussed on much before. I’ve done some searching (both here, and in general), but can’t find the answers (or even reasonable hints) to what I want to achieve (though, a few things come close-ish).

Basically, I’m trying to deserialize the data for the Google Chrome bookmarks file using the Json.NET library (though, if there’s a better alternative, I’m all for that – the documentation for this library is a little confusing in places). I’m a little confused as to the next step to take, due primarily to being used to PHP’s fantastic handling of JSON data (using json_decode()), allowing for a single function call, and then simple associative-array access.

The library (Json.NET) wants me to specify an Object type that it can deserialize the JSON data into, but I’m not really sure how to go about structuring such an Object, given the format of the Bookmarks file itself. The format is something along the lines of:

{    'roots': {       'bookmark_bar': {          'children': [ {             'children': [ {                'date_added': '12880758517186875',                'name': 'Example URL',                'type': 'url',                'url': 'http://example.com'             }, {                'date_added': '12880290253039500',                'name': 'Another URL',                'type': 'url',                'url': 'http://example.org'             } ],         'date_added': '12880772259603750',             'date_modified': '12880772452901500',             'name': 'Sample Folder',             'type': 'folder'          }, {             'date_added': '12880823826333250',             'name': 'Json.NET',             'type': 'url',             'url': 'http://james.newtonking.com/pages/json-net.aspx';          } ],          'date_added': '0',          'date_modified': '12880823831234250',          'name': 'Bookmarks bar',          'type': 'folder'       },       'other': {          'children': [  ],          'date_added': '0',          'date_modified': '0',          'name': 'Other bookmarks',          'type': 'folder'       }    },    'version': 1 } 

Now, in PHP, I’d be far more used to doing something along the lines of the following, to get the data I wanted, and ending up with ‘Json.NET’:

$data['roots']['bookmark_bar']['children'][0]['name']; 

I can work out, simply enough, what objects to create to represent the data (something like a root object, then a bookmark list object, and finally an individual bookmark object) – but I’m really not sure as to how to implement them, and then get the library to deserialize into the relevant objects correctly.

Any advice that can be offered would be greatly appreciated.

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-11T15:07:11+00:00Added an answer on May 11, 2026 at 3:07 pm

    It is not necessary to declare a type that reflects the json structure:

        using Newtonsoft.Json;     using Newtonsoft.Json.Linq;     using System.IO;     using System;      class Program     {         static void Main(string[] args)         {             string json =  @' {    ''roots'': {       ''bookmark_bar'': {          ''children'': [ {             ''children'': [ {                ''date_added'': ''12880758517186875'',                ''name'': ''Example URL'',                ''type'': ''url'',                ''url'': ''http://example.com''             }, {                ''date_added'': ''12880290253039500'',                ''name'': ''Another URL'',                ''type'': ''url'',                ''url'': ''http://example.org''             } ],         ''date_added'': ''12880772259603750'',             ''date_modified'': ''12880772452901500'',             ''name'': ''Sample Folder'',             ''type'': ''folder''          }, {             ''date_added'': ''12880823826333250'',             ''name'': ''Json.NET'',             ''type'': ''url'',             ''url'': ''http://james.newtonking.com/pages/json-net.aspx''          } ],          ''date_added'': ''0'',          ''date_modified'': ''12880823831234250'',          ''name'': ''Bookmarks bar'',          ''type'': ''folder''       },       ''other'': {          ''children'': [  ],          ''date_added'': ''0'',          ''date_modified'': ''0'',          ''name'': ''Other bookmarks'',          ''type'': ''folder''       }    },    ''version'': 1 } ';         using (StringReader reader = new StringReader(json))         using (JsonReader jsonReader = new JsonTextReader(reader))         {             JsonSerializer serializer = new JsonSerializer();             var o = (JToken)serializer.Deserialize(jsonReader);             var date_added = o['roots']['bookmark_bar']['children'][0]['date_added'];             Console.WriteLine(date_added);         }     } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I asked this question a few days ago, and I didn't get a lot
I originally asked this question on the Highcharts forum a few days ago but
A few days ago I asked a question about reading from file until the
[Hi, I asked this question in the morning but could not get any response
I believe that this question has been asked in a few different forms, but
In response to a question I asked about a week ago I changed our
I have asked that question but there is no response so i'll try to
I've asked this question on the Awesomium forms but I haven't received any response
I asked this question on superuser , but haven't gotten a response. Maybe here
Ok, so this question has been asked before here . In the response/answer to

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.