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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:03:42+00:00 2026-06-04T01:03:42+00:00

I’m working on a wrapper for dropbox in delphi 2012. The problem I’m running

  • 0

I’m working on a wrapper for dropbox in delphi 2012. The problem I’m running into is deserializing the json responses. When I make the request for a list of folders and files in my account I get a response that looks something like this:

{
    "hash": "some_hash",
    "thumb_exists": false, 
    "bytes": 0,
    "path": "/", 
    "is_dir": true, 
    "size": "0 bytes", 
    "root": "dropbox", 
    "contents": 
    [
        {
            "revision": 11, 
            "rev": "b074cbcbb", 
            "thumb_exists": false, 
            "bytes": 0, 
            "modified": "Mon, 23 Apr 2012 19:19:27 +0000", 
            "path": "/Apps", 
            "is_dir": true, 
            "icon": "folder", 
            "root": "dropbox", 
            "size": "0 bytes"
        }, 
        {    
            "revision": 142, 
            "rev": "8e074cbcbb", 
            "thumb_exists": false, 
            "bytes": 0, 
            "modified": "Wed, 09 May 2012 22:55:44 +0000", 
            "path": "/code", 
            "is_dir": true, 
            "icon": "folder", 
            "root": "dropbox", 
            "size": "0 bytes"
        },
        {
            "revision": 7,
            "rev": "7074cbcbb", 
            "thumb_exists": false, 
            "bytes": 246000, 
            "modified": "Mon, 23 Apr 2012 18:40:51 +0000", 
            "client_mtime": "Mon, 23 Apr 2012 18:40:52 +0000", 
            "path": "/Getting Started.pdf", 
            "is_dir": false, 
            "icon": "page_white_acrobat", 
            "root": "dropbox", 
            "mime_type": "application/pdf", 
            "size": "240.2 KB"
        }
    ],
    "icon": "folder"
}

I would like to be able to parse that using a TJSONUnMarshal object, but it turns out that TJSONUnMarshal expects the json to look like this instead:

{
"type":"DropboxApiU.TFile",
"id":1,
"fields":
{
    "hash": "some_hash",
    "thumb_exists": false, 
    "bytes": 0,
    "path": "/", 
    "is_dir": true, 
    "size": "0 bytes", 
    "root": "dropbox", 
    "contents": 
    [
        {
            "type":"DropboxApiU.TFile",
            "id":1,
            "fields":
            {
                "revision": 11, 
                "rev": "b074cbcbb", 
                "thumb_exists": false, 
                "bytes": 0, 
                "modified": "Mon, 23 Apr 2012 19:19:27 +0000", 
                "path": "/Apps", 
                "is_dir": true, 
                "icon": "folder", 
                "root": "dropbox", 
                "size": "0 bytes"
            }
        },

I’ve looked at this page and thought it might be what I’m looking for, but it never really goes into how to use a TTypeObjectReverter (which I think is what I need to use) and I can’t seem to find an example online.

What would be the best way to make this happen? I’m hoping I can just write a TTypeObjectReverter, or something similar, but I would need to see a sample to be able to wrap my head around that.

edit
Here’s a screenshot of the differences between the two. The red is not sent in the response from the dropbox server, but is expected by the unmarshaler.

Differences

  • 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-04T01:03:43+00:00Added an answer on June 4, 2026 at 1:03 am

    You could use my SvSerializer class for this task. First, you’ll need to define your class which you want to serialize/deserialize, e.g.:

    TDropbox = class
      private
        FHash: string;
        Fthumb_exists: Boolean;
        Fbytes: Integer;
        Fpath: string;
        Fis_dir: Boolean;
        FSize: string;
        Froot: string;
        Fcontents: TArray<TContent>;
        Ficon: string;
      public
        [SvSerialize]
        property Hash: string read FHash write FHash;
        [SvSerialize]
        property thumb_exists: Boolean read Fthumb_exists write Fthumb_exists;
        [SvSerialize]
        property bytes: Integer read Fbytes write Fbytes;
        [SvSerialize]
        property path: string read Fpath write Fpath;
        [SvSerialize]
        property is_dir: Boolean read Fis_dir write Fis_dir;
        [SvSerialize]
        property size: string read FSize write FSize;
        [SvSerialize]
        property root: string read Froot write Froot;
        [SvSerialize]
        property contents: TArray<TContent> read Fcontents write Fcontents;
        [SvSerialize]
        property icon: string read Ficon write Ficon;
      end;
    
    TContent = record
      private
        frevision: Integer;
        Frev: string;
        Fthumb_exists: Boolean;
        Fbytes: Integer;
        fmodified: string;
        fclient_mtime: string;
        fpath: string;
        fis_dir: Boolean;
        ficon: string;
        froot: string;
        fmime_type: string;
        fsize: string;
      public
        property revision: Integer read frevision write frevision;
        property rev: string read Frev write Frev;
        property thumb_exists: Boolean read Fthumb_exists write Fthumb_exists;
        property bytes: Integer read Fbytes write Fbytes;
        property modified: string read fmodified write fmodified;
        property client_mtime: string read fclient_mtime write fclient_mtime;
        property path: string read fpath write fpath;
        property is_dir: Boolean read fis_dir write fis_dir;
        property icon: string read ficon write ficon;
        property root: string read froot write froot;
        property mime_type: string read fmime_type write fmime_type;
        property size: string read fsize write fsize;
      end;
    

    Then add TDropbox object’s instance to serializer:

    FSerializer := TSvSerializer.Create();
    FDropboxFile := TDropbox.Create;
    FSerializer.AddObject('', FDropboxFile);
    

    And now you can serialize/deserialize this object through SvSerializer:

    FSerializer.DeSerialize(mmo1.Lines.Text{your json string, stream or filename}, TEncoding.UTF8{if it is string you must specify the encoding});
    //After this line your FDropBoxFile's properties are filled from your json string
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.