Click here to Skip to main content
15,441,280 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HI i Have a json data file i need to extract the data from. I'm struggling with objects etc. This is the file:

{
        "type": "Annotation",
        "body": [
            {
                "type": "TextualBody",
                "value": "Value No 1",
                "purpose": "commenting",
                "creator": {
                    "id": "2100",
                    "name": "James Smith"
                },
                "created": "2021-10-07T15:30:38.358Z",
                "modified": "2021-10-07T15:30:38.452Z"
            },
            {
                "type": "TextualBody",
                "value": "Value No 2",
                "purpose": "commenting",
                "creator": {
                    "id": "2400",
                    "name": "Paul Davies"
                },
                "created": "2021-10-07T15:50:15.252Z",
                "modified": "2021-10-07T15:50:15.699Z"
            }
        ],
        "target": {
            "source": "http://localhost:51583/Pages/Info/185.jpg",
            "selector": {
                "type": "FragmentSelector",
                "conformsTo": "http://www.w3.org/TR/media-frags/",
                "value": "xywh=pixel:1509.8331298828125,423.9666748046875,1223.5999755859375,445.433349609375"
            }
        },
        "@context": "http://www.w3.org/ns/anno.jsonld",
        "id": "#e719c51d-7096-4c0c-b4db-719fda585219"
    }


I would like to extract the data so i can put to screen/write to separate SQL database etc (i can do this).

I would like to get:
Value No 1, 2100, James Smith
Value No 2, 2400, Paul Davies

What I have tried:

Have tried all sorts of parsing. I can paste my existing code here but i've changed it so much i'm not sure where to begin anymore. Not sure best approach. Any code/pointers would be gratefully received. Any good resources i can research? Many Thanks!
Posted
Updated 9-Oct-21 6:27am

1 solution

No idea what you have done, since you failed to explain, but Json.NET - Newtonsoft[^] is the generally agreed best offering.
 
Share this answer
 
Comments
Member 10103170 9-Oct-21 12:51pm    
Thanks, stupidly forgot about that resource

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900