[fpc-pascal] Re: RESTful JSON: Your thoughts about implementation

bsquared bwcode4u at gmail.com
Fri Nov 9 00:05:52 CET 2012


On 11/08/2012 02:08 PM, Michael Van Canneyt wrote:
>
>
> 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  -
>>>>> fpc-pascal at lists.freepascal.org
>>>>> 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  -
>>> fpc-pascal at lists.freepascal.org
>>> 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  -
> fpc-pascal at lists.freepascal.org
> 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




More information about the fpc-pascal mailing list