Parsing JSON string to get all keys but with specific value pair name

Hi,

I would like to ask for help on how to get all the both the key and values of ValueString from this JSON string?

{  
  "analyzeResult": {    
    "documentResults": [
      {        
        "fields": {
          "Citizenship": {
            "type": "string",
            "valueString": "American",
            "valueDate": "0001-01-01T00:00:00",
            "valueTime": "0001-01-01T00:00:00",
            "valuePhoneNumber": null,
            "valueNumber": 0,
            "valueInteger": 0,
            "valueArray": null,
            "valueObject": null,
            "text": "Filipino",
            "boundingBox": [
              422,
              258,
              465,
              258,
              465,
              272,
              422,
              272
            ],
            "confidence": 0.677,
            "elements": null,
            "page": 1
          },
          "Status": {
            "type": "string",
            "valueString": "Single",
            "valueDate": "0001-01-01T00:00:00",
            "valueTime": "0001-01-01T00:00:00",
            "valuePhoneNumber": null,
            "valueNumber": 0,
            "valueInteger": 0,
            "valueArray": null,
            "valueObject": null,
            "text": "Single",
            "boundingBox": [
              423,
              242,
              460,
              242,
              460,
              255,
              423,
              255
            ],
            "confidence": 0.791,
            "elements": null,
            "page": 1
          },
          "Precint No.": {
            "type": "string",
            "valueString": "0042A",
            "valueDate": "0001-01-01T00:00:00",
            "valueTime": "0001-01-01T00:00:00",
            "valuePhoneNumber": null,
            "valueNumber": 0,
            "valueInteger": 0,
            "valueArray": null,
            "valueObject": null,
            "text": "0042A",
            "boundingBox": [
              452,
              340,
              491,
              340,
              491,
              354,
              452,
              354
            ],
            "confidence": 0.916,
            "elements": null,
            "page": 1
          },
          "Middle Name": {
            "type": "string",
            "valueString": "FIGUERAS",
            "valueDate": "0001-01-01T00:00:00",
            "valueTime": "0001-01-01T00:00:00",
            "valuePhoneNumber": null,
            "valueNumber": 0,
            "valueInteger": 0,
            "valueArray": null,
            "valueObject": null,
            "text": "FIGUERAS",
            "boundingBox": [
              315,
              194,
              395,
              194,
              395,
              210,
              315,
              210
            ],
            "confidence": 0.524,
            "elements": null,
            "page": 1
          },
          "Address": {
            "type": "string",
            "valueString": "CASILAGAN",
            "valueDate": "0001-01-01T00:00:00",
            "valueTime": "0001-01-01T00:00:00",
            "valuePhoneNumber": null,
            "valueNumber": 0,
            "valueInteger": 0,
            "valueArray": null,
            "valueObject": null,
            "text": ".. CASILAGAN",
            "boundingBox": [
              319,
              291,
              405,
              291,
              405,
              305,
              319,
              305
            ],
            "confidence": 0.628,
            "elements": null,
            "page": 1
          },
          "VIN": {
            "type": "string",
            "valueString": "3317-0042A-C2393RFJ10000",
            "valueDate": "0001-01-01T00:00:00",
            "valueTime": "0001-01-01T00:00:00",
            "valuePhoneNumber": null,
            "valueNumber": 0,
            "valueInteger": 0,
            "valueArray": null,
            "valueObject": null,
            "text": "3317-0042A-C2393RFJ10000",
            "boundingBox": [
              348,
              139,
              577,
              139,
              577,
              162,
              348,
              162
            ],
            "confidence": 0.863,
            "elements": null,
            "page": 1
          },
          "First Name": {
            "type": "string",
            "valueString": "RAYMARK",
            "valueDate": "0001-01-01T00:00:00",
            "valueTime": "0001-01-01T00:00:00",
            "valuePhoneNumber": null,
            "valueNumber": 0,
            "valueInteger": 0,
            "valueArray": null,
            "valueObject": null,
            "text": "RAYMARK",
            "boundingBox": [
              316,
              180,
              392,
              180,
              392,
              195,
              316,
              195
            ],
            "confidence": 0.408,
            "elements": null,
            "page": 1
          },
          "Last Name": {
            "type": "string",
            "valueString": "JUCUTAN",
            "valueDate": "0001-01-01T00:00:00",
            "valueTime": "0001-01-01T00:00:00",
            "valuePhoneNumber": null,
            "valueNumber": 0,
            "valueInteger": 0,
            "valueArray": null,
            "valueObject": null,
            "text": "JUCUTAN",
            "boundingBox": [
              317,
              165,
              389,
              165,
              389,
              180,
              317,
              180
            ],
            "confidence": 0.537,
            "elements": null,
            "page": 1
          },
          "DOB": {
            "type": "date",
            "valueString": March 23, 1993,
            "valueDate": "0001-01-01T00:00:00",
            "valueTime": "0001-01-01T00:00:00",
            "valuePhoneNumber": null,
            "valueNumber": 0,
            "valueInteger": 0,
            "valueArray": null,
            "valueObject": null,
            "text": "March 23, 1993",
            "boundingBox": [
              422,
              223,
              512,
              223,
              512,
              236,
              422,
              236
            ],
            "confidence": 0.816,
            "elements": null,
            "page": 1
          },
          "Driver's License No.": null,
          "Expiration Date": null,
          "Nationality": null,
          "Sex": null,
          "UMID No.": null
        }
      }
    ],
    "errors": []
  }
}

The output Iā€™m trying to achieve given the JSON string above is:

Citizenship: American
Status: Single
Precint No.: 0042A
Middle Name: FIGUERAS
Address: CASILAGAN
VIN: 3317-0042A-C2393RFJ10000
First Name: RAYMARK
Last Name: JUCUTAN
DOB: March 23, 1993

Thank you in advance.

Hi,

Is the Json format always fixed.

Thanks

@iamthejuan If the Format of the Json is the Same throughout , you can try this Workflow :
JsonValueExtraction.zip (2.4 KB)

3 Likes

@supermanPunch, I already solved my problem using regular expression but yours is a more elegant solution. Thank you. :slightly_smiling_face:

1 Like