AnsweredAssumed Answered

JSON list values of an array

Question asked by smith7180 on Sep 2, 2017
Latest reply on Feb 17, 2018 by beverly

Can I list the values for a particular key from an array?  Using FileMaker example JSON data (posted below), can I use JSONListValues to produce the following list (i.e. all the values of "name" from the "product" array):

 

Donuts

Chocolate Cake

Baguette

 

JSON data:

{

      "bakery" :

      {

          "product" :

           [

                {

                     "id" : "FB1",

                     "name" : "Donuts",

                     "price": 1.99,

                     "stock" : 43,

                     "category" : "Breads",

                     "special" : true

                },

                {

                     "id" : "FB2",

                     "price": 22.5,

                     "name" : "Chocolate Cake",

                     "stock" : 23,

                     "category" : "Cakes",

                     "special" : true

                },

                {

                     "id" : "FB3",

                     "price": 3.95,

                     "name" : "Baguette",

                     "stock" : 34,

                     "category" : "Breads",

                     "special" : true

                }

           ]

      }

}

 

Here's the escaped version for the data viewer:

 

"

{

     \"bakery\" :

     {

          \"product\" :

          [

               {

                    \"id\" : \"FB1\",

                    \"name\" : \"Donuts\",

                    \"price\": 1.99,

                    \"stock\" : 43,

                    \"category\" : \"Breads\",

                    \"special\" : true

               },

               {

                    \"id\" : \"FB2\",

                    \"price\": 22.5,

                    \"name\" : \"Chocolate Cake\",

                    \"stock\" : 23,

                    \"category\" : \"Cakes\",

                    \"special\" : true

               },

               {

                    \"id\" : \"FB3\",

                    \"price\": 3.95,

                    \"name\" : \"Baguette\",

                    \"stock\" : 34,

                    \"category\" : \"Breads\",

                    \"special\" : true

               }

          ]

     }

}

"

Outcomes