0

my input

{ "SheetID": "3605273345582980", "int_project_id": "4801220316292996", "123": "update row", "456": "duedeate", "789": "done", "101": "assine", "102": "done", "103": "thisis comment" }

expected output:-

[{ "cells": [{ "columnId": "123", "value": "update row", "strict": false }, { "columnId": "456", "value": "duedeate", "strict": false }, { "columnId": "789", "value": "done", "strict": false }, { "columnId": "101", "value": "assine", "strict": false }, { "columnId": "102", "value": "done", "strict": false }, { "columnId": "103", "value": "thisis comment", "strict": false } ] }]

code I tried

> [
    {
        "id": int_project_id,
        "cells": [ {{#each json_object}} {{#if @first}}{{else}} {
                "columnId": {{@key}},
                "value": "{{this}}",
                 "strict": false
            }{{#if @last}}{{else}},{{/if}} {{/if}} {{/each}}
        ]
    } ]

It worked I removed sheetId key and its value but now I want to remove int_project_id and its value while iteration And I cannot write custom helpers Any help is appreciated

  • Why are you using Handlebars to do this? If your objective is to output JSON, why not using `JSON.stringify` instead? See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify – 76484 Oct 18 '20 at 23:04
  • This answer might be helpful: https://stackoverflow.com/a/64419864/3397771 – 76484 Oct 19 '20 at 02:06

0 Answers0