Home > Software engineering >  How De-serialize response JSON with dynamic keys?
How De-serialize response JSON with dynamic keys?

Time:01-17

I know that this question is asked many times but still I'm struggling to understand this. I have below json to c# converted class.

{
"code": 200,
"data": [
    {
        "haythandi": {
            "posts": [
                {
                    "_id": "63bc6af77de2bb0602701c06",
                    "mediaLocation": {
                        "isHLS": 0,
                        "isTranscoded": true,
                        "duration": 27.033333,
                        "base": "https://media.chingari.io",
                        "thumbNailPath": "/uploads/postMedia/616b5ab60960fe0a9b3c15b0/e87c4374-b056-4bf2-98c3-aa01c932b985/thumbnail/e87c4374-b056-4bf2-98c3-aa01c932b985-1673292447009-post_thumbnail_ios.jpg",
                        "path": "/uploads/postMedia/616b5ab60960fe0a9b3c15b0/2470de86-80ba-4eb4-88f5-521676487728/video/2470de86-80ba-4eb4-88f5-521676487728-1673292439298-post_video_ios.mp4",
                        "mediaType": 2,
                        "f0": "/uploads/postMedia/616b5ab60960fe0a9b3c15b0/df50ea48-b628-478f-9698-bc830017468b/thumbnail/f0-2470de86-80ba-4eb4-88f5-521676487728-1673292439298-post_video_ios.jpg",
                        "thumbnail": "/uploads/2470de86-80ba-4eb4-88f5-521676487728-1673292439298-post_video_ios/thumbnail/e87c4374-b056-4bf2-98c3-aa01c932b985-1673292447009-post_thumbnail_ios.jpg",
                        "transcoded": {
                            "p1024": "/uploads/2470de86-80ba-4eb4-88f5-521676487728-1673292439298-post_video_ios/transcode/p720/2470de86-80ba-4eb4-88f5-521676487728-1673292439298-post_video_ios.mp4",
                            "p480": "/uploads/2470de86-80ba-4eb4-88f5-521676487728-1673292439298-post_video_ios/transcode/p480/2470de86-80ba-4eb4-88f5-521676487728-1673292439298-post_video_ios.mp4",
                            "p720": "/uploads/2470de86-80ba-4eb4-88f5-521676487728-1673292439298-post_video_ios/transcode/p720/2470de86-80ba-4eb4-88f5-521676487728-1673292439298-post_video_ios.mp4"
                        },
                        "compressedThumbnailPath": "/uploads/2470de86-80ba-4eb4-88f5-521676487728-1673292439298-post_video_ios/compressed_e87c4374-b056-4bf2-98c3-aa01c932b985-1673292447009-post_thumbnail_ios.jpg",
                        "oPath": "/uploads/2470de86-80ba-4eb4-88f5-521676487728-1673292439298-post_video_ios/outropath_2470de86-80ba-4eb4-88f5-521676487728-1673292439298-post_video_ios_outro.mp4",
                        "resizedThumbnailPath": "/uploads/2470de86-80ba-4eb4-88f5-521676487728-1673292439298-post_video_ios/resized_e87c4374-b056-4bf2-98c3-aa01c932b985-1673292447009-post_thumbnail_ios.jpg",
                        "resolution": {
                            "width": 720,
                            "height": 1280
                        },
                        "thumbnails": {
                            "w50": "/uploads/2470de86-80ba-4eb4-88f5-521676487728-1673292439298-post_video_ios/w50_e87c4374-b056-4bf2-98c3-aa01c932b985-1673292447009-post_thumbnail_ios.jpg",
                            "w150": "/uploads/2470de86-80ba-4eb4-88f5-521676487728-1673292439298-post_video_ios/w150_e87c4374-b056-4bf2-98c3-aa01c932b985-1673292447009-post_thumbnail_ios.jpg",
                            "w300": "/uploads/2470de86-80ba-4eb4-88f5-521676487728-1673292439298-post_video_ios/w300_e87c4374-b056-4bf2-98c3-aa01c932b985-1673292447009-post_thumbnail_ios.jpg",
                            "w700": "/uploads/2470de86-80ba-4eb4-88f5-521676487728-1673292439298-post_video_ios/w700_e87c4374-b056-4bf2-98c3-aa01c932b985-1673292447009-post_thumbnail_ios.jpg"
                        },
                        "webPath": "/uploads/2470de86-80ba-4eb4-88f5-521676487728-1673292439298-post_video_ios/webpath_2470de86-80ba-4eb4-88f5-521676487728-1673292439298-post_video_ios.mp4"
                    },
                    "tempMedia": {
                        "isHls": 0
                    },
                    "song": {
                        "_id": "63bc6afaf081af935c1c47d6",
                        "title": "Original audio by dimple_paul",
                        "art": null,
                        "author": "dimple_paul",
                        "categoryName": "Catagory-ugc",
                        "albumName": null,
                        "startTime": 0,
                        "endTime": 27.12,
                        "acrId": "976c4d5dcaa41cec5436c21faefb5e35"
                    },
                    "count": {
                        "likes": 4,
                        "views": 2340
                    },
                    "accessibility": {
                        "share": true,
                        "comment": true
                    },
                    "ownerData": {
                        "avatar": {
                            "base": "https://media.chingari.io"
                        },
                        "_id": "616b5ab60960fe0a9b3c15b0",
                        "name": "dimple_paul",
                        "username": "dimple_paul",
                        "status": "here to entertain you all♥️",
                        "profilePic": "/uploads/profilePic/b95e09f2-da01-4b83-abc1-a9e909a4f4e6-1634425786003.jpeg",
                        "isProfileVerified": 1,
                        "isFollowed": 0,
                        "tipEnabled": 1
                    },
                    "moderationStatus": {
                        "approval": 1,
                        "payment": 0,
                        "isModerated": true,
                        "moderatedBy": null,
                        "approvedBy": "5f225e75bd1e90080dac83c4",
                        "approvalDate": "2023-01-13T10:46:40.263Z",
                        "moderationDate": null,
                        "isAccepted": 1,
                        "acceptedBy": "5f315228d856d007ff83f75a",
                        "acceptanceDate": "2023-01-10T18:28:40.144Z",
                        "hashtagRejectReason": null,
                        "isOriginalAudio": 0,
                        "ogAudioAcceptedBy": null,
                        "ogAudioAcceptanceDate": null,
                        "ogAudioRejectReason": null,
                        "acceptedHashtagId": "63b954d8ac057906f7150651"
                    },
                    "taggedStatus": {
                        "isTagged": true,
                        "taggedBy": "6322c9c2983a09001aaa424b",
                        "taggedDate": "2023-01-10T06:13:51.416Z"
                    },
                    "etags": [
                        "b6b9e8060047c151f832cd1a6c2a2879"
                    ],
                    "isDuplicate": false,
                    "isProcessed": true,
                    "caption": "Come check my winter fashion video            
  • Related