Search code examples
javascriptjsongoogle-docsgoogle-docs-api

How can I omit the property names of my json and just display the values?


I wrote a small api to pull nutrition info from public diaries on MyFitnessPal. I'm pulling this information into a Google Sheet using the ImportJSON.gs found here: https://gist.github.com/paulgambill/cacd19da95a1421d3164

What I get is a two row result:

Calories    Protein Fat Carbs
2458        196     82  234

My returned json looks like this:

{"Calories":"1738","Protein":"140","Fat":"78","Carbs":"119"}

I want just the numbers and not the property names. I don't want to alter the json to just return a string array, but since this is for personal usage, I will if necessary! Any ideas?


Solution

  • var o = {"Calories":"1738","Protein":"140","Fat":"78","Carbs":"119"}
    var values = values(o); //gives you an array of values