<<Start>> <<End>> Function with Json Template

Hi there!

I’m trying to generate a JSON File using a parent/child table where the Parent table has the general data and the child has N number of rows depending on how many items the user wants to list.

What I did was to create a workflow to create a JSON file in the parent table using <<start: [Related child]>>
finishing with <<end>>, like this:

 {
  "date": "<<[date]>>T<<[hour]>>",
  "total": "<<[total]>>",
  "currency": "<<[currency]>>",
  "Great Total": "<<[Gtotal]>>",
  "Address": "<<[address]>>",
  "type": "<<[type]>>",
  "name": {
    "id": "<<[User_ID]>>",
    "client": "<<[client]>>"
   },
  "supplier": {
    "id_sup": "<<[id_sup]>>",
    "Name_sup": "<<[Name_sup]>>"
  },
  "Concepts": {
	"Concept": [
	<<Start:[Related child]>>	
        {
        "ProdServ": "<<[ProdServ]>>",
        "Units": "<<[Units]>>",
        "NoId": "<<[NoId]>>",
        "Qty": "<<[Qty]>>",
        "Desc": "<<[Desc]>>",
        "Price": "<<[Price]>>",
        "Total": "<<[Total]>>",
        "Taxes": {
          "Tax": {
            "Tax": [
              {
                "Base": "<<[Total]>>",
                "Tax": "<<[Tax_1]>>",
                "Tax$": "<<[Tax$]>>"
             }
	    ]
          }
        }
       },
      <<End>>
     ]
  },

The problem comes with the comma before the <<End>>, it shows in the JSON file and it shouldn’t, it should appear just between rows but not in the last child row, does anybody knows how to fix it??

Is the comma actually causing a problem, or is it an aesthetic thing? I have no experience using web hooks, but my impression is the dangling comma isn’t a technical problem (i.e., that it’s ignored).

Appsheet will automatically insert the appropriate comma between START iterations when used like this to create a JSON payload. You should be able to safely remove your manual comma.

Thanks Steve, the problem is that if I don’t use the comma in this way the json file doesn’t respect the child records because they are not separated by the comma, but if I leave it in the template the comma remains even until the last record and that is also generating an error in the json file

1 Like

Thanks Marc, I thought that too but it doesn’t work this way with my template, I don’t know why