As per my understanding, we can use Base.64 to encode a string or map to string. But I am facing trouble here, converting the map to string isn't working its giving empty JSON.
So is there any way we can directly encode Map<String,Object>
to String
value either by using Base64
or converting map
to string
value.
Base64.getEncoder().encodeToString(“actualString”.getBytes());
I tried converting Map to String. It isn't working.
Now, instead of string, I want to pass a map. Please suggest some single line optimized code to encode Map<String,Object>
to String
value.
Base64.getEncoder().encodeToString(String.format("string1","string2","string3").getBytes());