Base solution for your next web application
Open Closed

Preprocess json payload in request #7846


User avatar
0
peopleteq created

Hi,

I need preporcess json payload on API call request, eg remove prefixes in name properties on json objects:

{ foo.bar.item: "value" }

to

{ item: "value" }

I need do this because not all API users can send data in required format. Can that be done within ANZ or that shold be done with ASP.NET Core only? I guess that can be done with middleware, I will very appreciate if you will show example

Thanks


4 Answer(s)
  • User Avatar
    0
    peopleteq created

    A;so preprocessing should be done not for all API of the host, only for exact services and much better for exact paths

  • User Avatar
    0
    peopleteq created

    Just want to specify my request. JSON should be (if possible) be processed not in request (I mean modyfing request body), but somewhere on upper lever like validation works.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @peopleteq

    Yes, you can do it by writing a custom AspNet Core middleware. Just be sure that, you add that middleware before the ones who needs the modified json format.

  • User Avatar
    0
    peopleteq created

    Thanks!