Server API post JSON data array

Tried that one too, but then the entire server action fails and gives a 500 error.

I really think wappler doesn’t handle the array’s well in this specific case.

what is the server error that you get when you enclose your dynamic expressions in quotes?
That should always be done within JSON btw.

There is no dynamic data (just testing static data for now).

Using Postman:

Using Wappler:

But that’s because Wappler outputs it like this, which Postman doesn’t do:

"[\n {\n \"client_id\": 113974,\n \"table_name\": \"customers\",\n \"sequence\": 1565881320,\n \"key_names\": [\n \"id\"\n ],\n \"data\": {\n \"id\": 1,\n \"name\": \"Finn\"\n },\n \"action\": \"upsert\"\n }\n]"

I think I found the problem - is indeed when you have JSON data starting as array, so with [ and ]

if it starts with { } as object it goes all fine.

So will investigate further

2 Likes

are you sure you need the [ and ] - because usually you are posting a single object with JSON …

I would say it should ideally work with [ and ] as well, as it’s a perfectly valid JSON.

1 Like

Yes I found that odd too, but the receiving API expects it to be in an array. As you can see by the error.

It is a good one - will add array compatibility too.

2 Likes

Did you ever managed to fix this? Looks like can’t POST JSON arrays, related issue: