Clarion 6.3 and JSon Consumption


#1

Hi,

I need to consume JSon with Clarion 6.3.
In the JSon that I receive there will be a Base64 Encoded PDF file.

Is there a way to consume the JSon in Clarion 6.3 and decode the PDF and save it to disk?

Regards

Johan de Klerk


#2

You could use the Chilkat classes. You would use the JSON class to load, parse and extract the PDF string from your incoming JSON. Then use a StringBuilder class object to decode it and then save to file.

http://www.chilkatsoft.com
*One bundle license gets all classes for all platforms.

I also do the same basic thing in C9.1/C10 using SOAP with NetTalk & xFiles .

db


#3

Johan,

There is support in C6.3 for Base64 encoding in abmime.clw/inc. I haven’t used it so you’ll need to test.
As far as processing json. You could look at jfiles from Capesoft. There isn’t official support for C6.3, but it is all source files, so I’m sure you could migrate it back to C6.3.
Or if the json isn’t very complicated you could write the string manipulation to pull out what you need.

Rick


#4

Another option is to dabble in a little bit of interop and do it via .Net


#5

A post was split to a new topic: Base64 decoding function


#6

Hi Dave,
Thanks for the link to the ChilkatSoft site.
However at this stage cost is a big factor and I only need the JSon for one project that will not generate any extra income.

Hi Brahn,
.Net if far beyond my capabilities.
I also have customers still running Windows XP so I am not sure if they will have .Net installed on their computers and if installed what version it will be.

Hi Mike,
Thanks for the code suggestion.
Luckily the StringTheory for C6.3 that I have does support Base64 Encoding and Decoding.

Hi Rick,
Thanks for the suggestion.
I copied the JFiles files from my C10 to C6.3 and registered the JFiles template without problems.
Compiled a simple app that I just added the JFiles and StringTheory templates.
It however gave me a lot of missing errors because it relies on StringTheory so I copied the StringTheory files from my C10 to my C6.3.
The simple app compiled without any errors.

However compiling my NetTalk Webapp gave me errors with invalid use of private data.
This is where I realized it is now starting to go beyond my capabilities.

I should receive a sample of the JSon file on Monday and will then have to look at your suggestion of using string manipulation to extract the part I need then decode it.

Regards

Johan de Klerk


#7

Yeah, that could make it less that worth the effort.


#8

If you have Clarion EE you could also try the same trick for the shipping json classes.


#9

Hi Johan,
I didn’t realize you had Clarion 10, too.
As @brahn pointed out there is a json class in Clarion 10: Json.clw/inc.
Also, the SystemString class has base64 encoding methods.
Check those out. I’m sure you can port back to C6.3 with a bit of work.

Rick