byte[] Base64 in json

2
Hi, I’m having trouble getting the value from a JSON.  I do not control the service that is sending this data. I do know it sends it in binary data in the JSON and shuld be a Base64 encoded file into a String. I cannot decode it because the mapping keeps giving me problems…   From this JSON:     To this IM:   But as you can see the asso is wrong: i need one to one…. Idea’s on this?   Thanks ahead!
asked
6 answers
3

In your microflow, when you retrieve the entity Wrapper (via association), the next step should be list operation Head, to get the first object.  Then you can use the string value and decode it to a file.

**EDIT**

To confirm that you are receiving JSON with the contents you expect, set log level for REST Consume to Trace (in Studio Pro, in the Console tab, select the Advance menu and then select Set Log Levels).  This will show you the actual JSON that is being returned to your app from the call.  Can you do that and then paste the returned JSON into this thread?

answered
2

It cannot be one-one because in your json you have an array, which may have multiple values. Are you sure the json is correct?

May be it should be like this

{

“document” : “string”

}

instead of an array.

answered
0

Hi Shreyash,

Yes, I’m sure of it, it comes from the swagger…
I did try to do it without the [] but no effect…

 

Any other ideas?

 

answered
0

Hi Mike, the thing is that the string is not mapped correctly…

So even if I do retrieve it via the head list the object is empty (as is the list of course)…
 

I think it is really a mapping problem.

 

Other ideas?

answered
0

Hi Mike, 

It gives me this:

 

Response content for GET request to https://api.a…….../encoding
HTTP/1.1 200 OK
Access-Control-Expose-Headers: 
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET
Access-Control-Allow-Headers: authorization,Authorization,Access-Control-Allow-Origin,Content-Type,SOAPAction,apikey,Organisation,Target-Organisation,Target-Organisation-Description,
User-Organisation,User-Organisation-Description,Application,User-Id,User-Reference,Accept-Language,Authorization
Content-Type: application/json; charset=UTF-8
Date: Wed, 02 Feb 2022 14:55:59 GMT
Connection: Keep-Alive
Transfer-Encoding: chunked

{"document":"YUIOPKJHNerdfJKL....."}

 

(… is of course a lot of other stuff)

answered
0

Hi Mike, I did already try but at the time I did not put any right on the non persistable. Now, with read and wwrite, I get the base64string just fine.
Thanks for the input.

 

 

answered