Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-11

RESTful JSON: Your thoughts about implementation

9 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

bsquared

Hello,

I thought I would put this out to see what helpful information I could gather.

I am in need of some JSON and HTTP functionality. I am thinking about using some pieces from WST and I was looking for some input on this.

What I am doing is pulling data from a JSON-RESTful web application and storing it in SQLite as Key / Value Pairs along with some meta data.

This data will be pushed back to same web application on some interval.

Additionally, I would like cross-platform compatibility between Linux/Windows{,-mobile?}/Android.

Any thoughts?

Regards, Brian

Reply by email

Michael Van Canneyt
to bsquared
bsquared wrote 15 lines
Hello, I thought I would put this out to see what helpful information I could gather. I am in need of some JSON and HTTP functionality. I am thinking about using some pieces from WST and I was looking for some input on this. What I am doing is pulling data from a JSON-RESTful web application and storing it in SQLite as Key / Value Pairs along with some meta data. This data will be pushed back to same web application on some interval. Additionally, I would like cross-platform compatibility between Linux/Windows{,-mobile?}/Android.

Why do you need WST for this ? if it is REST (something WST knows nothing about), then you'll work just fine with only the fpJSON and synapse stacks ?

Michael.

Reply by email

bsquared
to Michael Van Canneyt
Michael Van Canneyt wrote 30 lines
On Thu, 8 Nov 2012, bsquared wrote: > Hello, > > I thought I would put this out to see what helpful information I could > gather. > > I am in need of some JSON and HTTP functionality. I am thinking about > using some pieces from WST and I was looking for some input on this. > > What I am doing is pulling data from a JSON-RESTful web application > and storing it in SQLite as Key / Value Pairs along with some meta data. > > This data will be pushed back to same web application on some interval. > > Additionally, I would like cross-platform compatibility between > Linux/Windows{,-mobile?}/Android. Why do you need WST for this ? if it is REST (something WST knows nothing about), then you'll work just fine with only the fpJSON and synapse stacks ? Michael. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

I was looking at the TJsonRpcBaseFormatter as well as the factory implementations *_http_protocol units.

Seemed like some of the work had been done here.

Regards, Brian

Reply by email

Michael Van Canneyt
to bsquared
bsquared wrote 36 lines
On 11/08/2012 09:47 AM, Michael Van Canneyt wrote: > > > On Thu, 8 Nov 2012, bsquared wrote: > >> Hello, >> >> I thought I would put this out to see what helpful information I could >> gather. >> >> I am in need of some JSON and HTTP functionality. I am thinking about >> using some pieces from WST and I was looking for some input on this. >> >> What I am doing is pulling data from a JSON-RESTful web application >> and storing it in SQLite as Key / Value Pairs along with some meta data. >> >> This data will be pushed back to same web application on some interval. >> >> Additionally, I would like cross-platform compatibility between >> Linux/Windows{,-mobile?}/Android. > > Why do you need WST for this ? if it is REST (something WST knows > nothing about), then you'll work just fine with only the fpJSON and > synapse stacks ? > > Michael. > _______________________________________________ > fpc-pascal maillist - > > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > I was looking at the TJsonRpcBaseFormatter as well as the factory implementations *_http_protocol units. Seemed like some of the work had been done here.

These protocols are aimed towards RPC, which is not something I associate with REST implementations, so your solution seems confusing.

Without more details it is hard to give advice...

Michael.

Reply by email

bsquared
to Michael Van Canneyt
Michael Van Canneyt wrote 53 lines
On Thu, 8 Nov 2012, bsquared wrote: > On 11/08/2012 09:47 AM, Michael Van Canneyt wrote: >> >> >> On Thu, 8 Nov 2012, bsquared wrote: >> >>> Hello, >>> >>> I thought I would put this out to see what helpful information I could >>> gather. >>> >>> I am in need of some JSON and HTTP functionality. I am thinking about >>> using some pieces from WST and I was looking for some input on this. >>> >>> What I am doing is pulling data from a JSON-RESTful web application >>> and storing it in SQLite as Key / Value Pairs along with some meta >>> data. >>> >>> This data will be pushed back to same web application on some interval. >>> >>> Additionally, I would like cross-platform compatibility between >>> Linux/Windows{,-mobile?}/Android. >> >> Why do you need WST for this ? if it is REST (something WST knows >> nothing about), then you'll work just fine with only the fpJSON and >> synapse stacks ? >> >> Michael. >> _______________________________________________ >> fpc-pascal maillist - >> >> http://lists.freepascal.org/mailman/listinfo/fpc-pascal >> > > I was looking at the TJsonRpcBaseFormatter as well as the factory > implementations *_http_protocol units. > > Seemed like some of the work had been done here. These protocols are aimed towards RPC, which is not something I associate with REST implementations, so your solution seems confusing. Without more details it is hard to give advice... Michael. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Thank you, your input is helpful. It has been some time since I have used the tools.

I thought the json parsing in the TJsonRpcBaseFormatter may be a good starting place. To my semi-trained eye it will deserialize the json into a TStack object, but I have not done any testing yet. Am I not interpretting this correctly?

As far as the http stack goes -- I'm open. I recall from my past experience that synapse is stable and lightweight.

Regards, Brian

Reply by email

bsquared
to Michael Van Canneyt: These protocols are aimed towards RPC, which is not something I associate with REST…
Michael Van Canneyt wrote 53 lines
On Thu, 8 Nov 2012, bsquared wrote: > On 11/08/2012 09:47 AM, Michael Van Canneyt wrote: >> >> >> On Thu, 8 Nov 2012, bsquared wrote: >> >>> Hello, >>> >>> I thought I would put this out to see what helpful information I could >>> gather. >>> >>> I am in need of some JSON and HTTP functionality. I am thinking about >>> using some pieces from WST and I was looking for some input on this. >>> >>> What I am doing is pulling data from a JSON-RESTful web application >>> and storing it in SQLite as Key / Value Pairs along with some meta >>> data. >>> >>> This data will be pushed back to same web application on some interval. >>> >>> Additionally, I would like cross-platform compatibility between >>> Linux/Windows{,-mobile?}/Android. >> >> Why do you need WST for this ? if it is REST (something WST knows >> nothing about), then you'll work just fine with only the fpJSON and >> synapse stacks ? >> >> Michael. >> _______________________________________________ >> fpc-pascal maillist - >> >> http://lists.freepascal.org/mailman/listinfo/fpc-pascal >> > > I was looking at the TJsonRpcBaseFormatter as well as the factory > implementations *_http_protocol units. > > Seemed like some of the work had been done here. These protocols are aimed towards RPC, which is not something I associate with REST implementations, so your solution seems confusing. Without more details it is hard to give advice... Michael. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

After some rudimentary testing I believe that TJsonRpcBaseFormatter is not suitable for this implementation. Although I may draw inspiration from the code.

Thank you for your insight.

Regards, Brian

Reply by email

Michael Van Canneyt
to bsquared
bsquared wrote 60 lines
On 11/08/2012 09:56 AM, Michael Van Canneyt wrote: > > > On Thu, 8 Nov 2012, bsquared wrote: > >> On 11/08/2012 09:47 AM, Michael Van Canneyt wrote: >>> >>> >>> On Thu, 8 Nov 2012, bsquared wrote: >>> >>>> Hello, >>>> >>>> I thought I would put this out to see what helpful information I could >>>> gather. >>>> >>>> I am in need of some JSON and HTTP functionality. I am thinking about >>>> using some pieces from WST and I was looking for some input on this. >>>> >>>> What I am doing is pulling data from a JSON-RESTful web application >>>> and storing it in SQLite as Key / Value Pairs along with some meta >>>> data. >>>> >>>> This data will be pushed back to same web application on some interval. >>>> >>>> Additionally, I would like cross-platform compatibility between >>>> Linux/Windows{,-mobile?}/Android. >>> >>> Why do you need WST for this ? if it is REST (something WST knows >>> nothing about), then you'll work just fine with only the fpJSON and >>> synapse stacks ? >>> >>> Michael. >>> _______________________________________________ >>> fpc-pascal maillist - >>> >>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal >>> >> >> I was looking at the TJsonRpcBaseFormatter as well as the factory >> implementations *_http_protocol units. >> >> Seemed like some of the work had been done here. > > These protocols are aimed towards RPC, which is not something I > associate with REST implementations, so your solution seems confusing. > > Without more details it is hard to give advice... > > Michael. > _______________________________________________ > fpc-pascal maillist - > > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > After some rudimentary testing I believe that TJsonRpcBaseFormatter is not suitable for this implementation. Although I may draw inspiration from the code. Thank you for your insight.

You may want to try the fpjsonrtti unit to transform objects into RTTI and vice versa. I use it myself heavily to implement data traffic in a webserver.

Michael.

Reply by email

bsquared
to Michael Van Canneyt
Michael Van Canneyt wrote 78 lines
On Thu, 8 Nov 2012, bsquared wrote: > On 11/08/2012 09:56 AM, Michael Van Canneyt wrote: >> >> >> On Thu, 8 Nov 2012, bsquared wrote: >> >>> On 11/08/2012 09:47 AM, Michael Van Canneyt wrote: >>>> >>>> >>>> On Thu, 8 Nov 2012, bsquared wrote: >>>> >>>>> Hello, >>>>> >>>>> I thought I would put this out to see what helpful information I >>>>> could >>>>> gather. >>>>> >>>>> I am in need of some JSON and HTTP functionality. I am thinking >>>>> about >>>>> using some pieces from WST and I was looking for some input on this. >>>>> >>>>> What I am doing is pulling data from a JSON-RESTful web application >>>>> and storing it in SQLite as Key / Value Pairs along with some meta >>>>> data. >>>>> >>>>> This data will be pushed back to same web application on some >>>>> interval. >>>>> >>>>> Additionally, I would like cross-platform compatibility between >>>>> Linux/Windows{,-mobile?}/Android. >>>> >>>> Why do you need WST for this ? if it is REST (something WST knows >>>> nothing about), then you'll work just fine with only the fpJSON and >>>> synapse stacks ? >>>> >>>> Michael. >>>> _______________________________________________ >>>> fpc-pascal maillist - >>>> >>>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal >>>> >>> >>> I was looking at the TJsonRpcBaseFormatter as well as the factory >>> implementations *_http_protocol units. >>> >>> Seemed like some of the work had been done here. >> >> These protocols are aimed towards RPC, which is not something I >> associate with REST implementations, so your solution seems confusing. >> >> Without more details it is hard to give advice... >> >> Michael. >> _______________________________________________ >> fpc-pascal maillist - >> >> http://lists.freepascal.org/mailman/listinfo/fpc-pascal >> > > After some rudimentary testing I believe that TJsonRpcBaseFormatter is > not suitable for this implementation. Although I may draw inspiration > from the code. > > Thank you for your insight. You may want to try the fpjsonrtti unit to transform objects into RTTI and vice versa. I use it myself heavily to implement data traffic in a webserver. Michael. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

I agree. I intend to study that unit in more detail. The end result I want is to transform json as a string or stream to a map. I don't think it will be too difficult. My first thought was to use TJSONDeStreamer and TJSONStreamer from fpjsonrtti. Then I became distracted by all the shiny factory stuff in WST. -)

Regards, Brian

Reply by email

bsquared
to bsquared: I thought I would put this out to see what helpful information I could gather. I am in…
bsquared wrote 18 lines
Hello, I thought I would put this out to see what helpful information I could gather. I am in need of some JSON and HTTP functionality. I am thinking about using some pieces from WST and I was looking for some input on this. What I am doing is pulling data from a JSON-RESTful web application and storing it in SQLite as Key / Value Pairs along with some meta data. This data will be pushed back to same web application on some interval. Additionally, I would like cross-platform compatibility between Linux/Windows{,-mobile?}/Android. Any thoughts?

As it turns out I was over thinking the task or underestimating the fcl. As was posted by Michael Van Canneyt fpjson met my needs.

Thanks for the help.

Regards, Brian

Reply by email