AnsweredAssumed Answered

Trouble Parsing JSON

Question asked by chuladi on Sep 17, 2017
Latest reply on Sep 18, 2017 by chuladi

I'm a bit stumped with this one. I've been trying to crate a script that will loop through this JSON statement and parse it. The problem is, I can't figure out how to write it.

 

Please bare with me as I just 2 days ago downloaded Filemaker 16 just to have these functions,

 

I know how to get to data like "mari smith" (key), "impressions" etc. What I can't figure out is how to create the loop for the actions of each key, without specifying the key by name.

 

Or, if I must specify the key by name, I have that part worked out, but I can't figure out how to use the name as a variable in the JSON GetElement function.

 

If you can help, I will be eternally grateful and please excuse me if my verbiage is off.

 

Thank you!

 

 

 

{

  "data": {

    "mari smith": {

      "impressions": 602,

      "actions": [

        {

          "action_type": "attention_event",

          "value": "84"

        },

        {

          "action_type": "comment",

          "value": "1"

        },

        {

          "action_type": "landing_page_view",

          "value": "6"

        },

        {

          "action_type": "link_click",

          "value": "8"

        },

        {

          "action_type": "offsite_conversion.fb_pixel_aggregate_custom_conversion",

          "value": "16"

        },

        {

          "action_type": "offsite_conversion.fb_pixel_purchase",

          "value": "2"

        },

        {

          "action_type": "offsite_conversion.fb_pixel_view_content",

          "value": "13"

        },

        {

          "action_type": "page_engagement",

          "value": "9"

        },

        {

          "action_type": "post_engagement",

          "value": "9"

        },

        {

          "action_type": "offsite_conversion",

          "value": "15"

        },

        {

          "action_type": "view_content",

          "value": "13"

        },

        {

          "action_type": "purchase",

          "value": "2"

        }

      ],

      "id": "6002893416422"

    },

    "social media week": {

      "impressions": 178,

      "actions": [

        {

          "action_type": "attention_event",

          "value": "25"

        },

        {

          "action_type": "landing_page_view",

          "value": "1"

        },

        {

          "action_type": "link_click",

          "value": "1"

        },

        {

          "action_type": "offsite_conversion.fb_pixel_aggregate_custom_conversion",

          "value": "23"

        },

        {

          "action_type": "offsite_conversion.fb_pixel_view_content",

          "value": "28"

        },

        {

          "action_type": "page_engagement",

          "value": "1"

        },

        {

          "action_type": "post_engagement",

          "value": "1"

        },

        {

          "action_type": "offsite_conversion",

          "value": "28"

        },

        {

          "action_type": "view_content",

          "value": "28"

        }

      ],

      "id": "6003095869633"

    },

    "social media today": {

      "impressions": 696,

      "actions": [

        {

          "action_type": "attention_event",

          "value": "93"

        },

        {

          "action_type": "landing_page_view",

          "value": "4"

        },

        {

          "action_type": "link_click",

          "value": "5"

        },

        {

          "action_type": "offsite_conversion.fb_pixel_aggregate_custom_conversion",

          "value": "47"

        },

        {

          "action_type": "offsite_conversion.fb_pixel_purchase",

          "value": "1"

        },

        {

          "action_type": "offsite_conversion.fb_pixel_view_content",

          "value": "72"

        },

        {

          "action_type": "post_like",

          "value": "1"

        },

        {

          "action_type": "page_engagement",

          "value": "6"

        },

        {

          "action_type": "post_engagement",

          "value": "6"

        },

        {

          "action_type": "offsite_conversion",

          "value": "73"

        },

        {

          "action_type": "view_content",

          "value": "72"

        },

        {

          "action_type": "purchase",

          "value": "1"

        }

      ],

      "id": "6003101597584"

    },

    "amy porterfield": {

      "impressions": 7002,

      "actions": [

        {

          "action_type": "attention_event",

          "value": "969"

        },

        {

          "action_type": "landing_page_view",

          "value": "22"

        },

        {

          "action_type": "link_click",

          "value": "25"

        },

        {

          "action_type": "offsite_conversion.fb_pixel_aggregate_custom_conversion",

          "value": "235"

        },

        {

          "action_type": "offsite_conversion.fb_pixel_purchase",

          "value": "4"

        },

        {

          "action_type": "offsite_conversion.fb_pixel_view_content",

          "value": "228"

        },

        {

          "action_type": "photo_view",

          "value": "7"

        },

        {

          "action_type": "post",

          "value": "1"

        },

        {

          "action_type": "post_like",

          "value": "13"

        },

        {

          "action_type": "page_engagement",

          "value": "46"

        },

        {

          "action_type": "post_engagement",

          "value": "46"

        },

        {

          "action_type": "offsite_conversion",

          "value": "232"

        },

        {

          "action_type": "view_content",

          "value": "228"

        },

        {

          "action_type": "purchase",

          "value": "4"

        }

      ],

      "id": "6003140192190"

    },  

      ],

      "id": "6018042684827"

    }

  }

}

Outcomes