90
Views
3
Comments
Validate if string is a valid Base64 string
Question

Hi all,

I have a project where I need to download data from a JSON file. The binary data has been stored as a Base64 text in the JSON. 

Since the JSON also composes of other question types I want to check if the string being handled is a valid Base64 string. If this is the case, I want the Base64ToBinary action from BinaryData extension to convert it back to binary and add it to a list of binary files to download later. 

Is there any such action available in OutSystems? 

Max

2018-10-29 08-31-03
João Marques
 
MVP

Hi Max,


I don't think this is available, but you can built very quickly an extension to do this on .NET and use it in OutSystems. Browsing quickly on Google, there are a few suggestions on how to do this, like this StackOverflow post.


Kind Regards,
João

2020-07-02 13-32-59
Max de Groot

Thanks for the quick reply! 

Will try to work on a .NET extension :)

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Not sure what Base64ToBinary returns when it's not presented with a valid Base64 string? In case it raises an exception, you could encapsulate it in an action and handle the exception, e.g. returning an "IsValid" that's set to True if there's no exception.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.