Setting server side object variables

Hi @mebeingken, did you find a solution for your original question-1. I have a nested json post’d from client-side form to server-side. On the server side, I have to process this json and literally change one value conditionally.

image

To my limited knowledge, I couldn’t find any direct way like $_POST.search_config.terms[1].term_name = “newvalue”. My understanding is, the whole nested json has to be put through a repeat, update during the loop, and has to be re-assigned to a new similar nested variable with output ticked.

Is this the only way, would you know? Thanks!

Well, I actually moved on from that as #2 was solved. Is your json going to be in a textarea input within a post form?

Yes, followed this guide… Send nested JSON with server-side API, using hidden textbox and submitting via form post!

Just to clarify…That seems to describe using multiple inputs (one for each element,) not one with the entire json…which are you doing?

Tried posting entire json, but realised that I had to convert to string on client-side & then decode the json on server-side, and that was too much for me, as currently there are no wappler out-of-the-box formatters for this…

Hence, ended up implementing the multiple inputs technique… The above nested json object is on server side, automatically generated by linking the client-side form.

I have some processing to be applied on this json data, and has to happen on server side. So, trying to achieve that, but looks very tedious as I can’t directly initialise any value in this json data without looping using repeats.

I guess my first thought is – if this json is from a client side api, could you move it to server so you can just deal with it as output from the call?

Or, you can always go the custom formatter route.

1 Like

I have hit the same dead-end multiple times now - the need to create custom formatter for basic json (from non-apis) encoding/decoding & processing… wish wappler had these out-of-the-box components esp on the server side… :pensive:

1 Like