Can I have JSON formatted data submitted to a Lasso page?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Can I have JSON formatted data submitted to a Lasso page?

Carl Ketterling
I have an app that¹s submitting JSON formatted data to a Lasso 9 page, and I
can¹t figure out how to get that data into a variable.  Is that possible? Or
does the data have to be submitted in a matched pair format?

Carl
#############################################################
Attend the Lasso Developer Conference 2014!
October 1-3, 2014 at Treefrog HQ, Newmarket, Ontario, Canada
http://www.lassosoft.com/LDC-newmarket-2014

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Can I have JSON formatted data submitted to a Lasso page?

Jonathan Guthrie-3
Hi Carl,

The data's likely to be coming in as a POST param, so I suggest logging web_request->params and see what's there, and then treat it as a standard web request.

On Aug 23, 2014, at 12:43 PM, Carl Ketterling <[hidden email]> wrote:

> I have an app that¹s submitting JSON formatted data to a Lasso 9 page, and I
> can¹t figure out how to get that data into a variable.  Is that possible? Or
> does the data have to be submitted in a matched pair format?
>
> Carl

Jono

----------------------------
Jonathan Guthrie
[hidden email]
@iamjono
LassoSoft Inc.
AIM Chatroom: lassochat

#############################################################
Attend the Lasso Developer Conference 2014!
October 1-3, 2014 at Treefrog HQ, Newmarket, Ontario, Canada
http://www.lassosoft.com/LDC-newmarket-2014

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Can I have JSON formatted data submitted to a Lasso page?

decorior
Once you see the parameters as a json string then you can convert is to a map/array in lasso using json_deserialize

We are actually passing all our parameters this way now.

Deco


On Aug 23, 2014, at 11:22 AM, Jonathan Guthrie <[hidden email]> wrote:

> Hi Carl,
>
> The data's likely to be coming in as a POST param, so I suggest logging web_request->params and see what's there, and then treat it as a standard web request.
>
> On Aug 23, 2014, at 12:43 PM, Carl Ketterling <[hidden email]> wrote:
>
>> I have an app that¹s submitting JSON formatted data to a Lasso 9 page, and I
>> can¹t figure out how to get that data into a variable.  Is that possible? Or
>> does the data have to be submitted in a matched pair format?
>>
>> Carl
>
> Jono
>
> ----------------------------
> Jonathan Guthrie
> [hidden email]
> @iamjono
> LassoSoft Inc.
> AIM Chatroom: lassochat
>
> #############################################################
> Attend the Lasso Developer Conference 2014!
> October 1-3, 2014 at Treefrog HQ, Newmarket, Ontario, Canada
> http://www.lassosoft.com/LDC-newmarket-2014
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>

#############################################################
Attend the Lasso Developer Conference 2014!
October 1-3, 2014 at Treefrog HQ, Newmarket, Ontario, Canada
http://www.lassosoft.com/LDC-newmarket-2014

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Can I have JSON formatted data submitted to a Lasso page?

Carl Ketterling
In reply to this post by Jonathan Guthrie-3
Hey Jono,

Here¹s the information I gathered (I probably should have included this in
my first post):

If I use ³web_request->raw², I get a map that starts with:
> CONTENT_LENGTH = 264,
> CONTENT_TYPE = application/json,

If I use ³action_params², I get this:

> staticarray(( = ), ({
>   "inquiry": {
>     "emailOptions": [
>       "[hidden email]",
>       "[hidden email]"
>     ],
>     "data": "mydata",
>     "id": "myid"
>   }
> } = ))

Because I don¹t see pairs, and because I see ³CONTENT_TYPE =
application/json², I thought the data was being sent as a JSON blob.  I
thought I would be able to find a way to move that blob into something
suitable for json_deserialize per your document (
http://jono.guthrie.net.nz/Making-JSON-Simple ).

Can you tell me how to do this?

Carl



From: Jonathan Guthrie <[hidden email]>
Reply-To: <[hidden email]>
Date: Sat, 23 Aug 2014 13:22:05 -0400
To: LassoTalk List <[hidden email]>
Subject: Re: Can I have JSON formatted data submitted to a Lasso page?

Hi Carl,

The data's likely to be coming in as a POST param, so I suggest logging
web_request->params and see what's there, and then treat it as a standard
web request.

On Aug 23, 2014, at 12:43 PM, Carl Ketterling <[hidden email]> wrote:

> I have an app that¹s submitting JSON formatted data to a Lasso 9 page, and I
> can¹t figure out how to get that data into a variable.  Is that possible? Or
> does the data have to be submitted in a matched pair format?
>
> Carl

Jono

----------------------------
Jonathan Guthrie
[hidden email]
@iamjono
LassoSoft Inc.
AIM Chatroom: lassochat

#############################################################
Attend the Lasso Developer Conference 2014!
October 1-3, 2014 at Treefrog HQ, Newmarket, Ontario, Canada
http://www.lassosoft.com/LDC-newmarket-2014

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>

#############################################################
Attend the Lasso Developer Conference 2014!
October 1-3, 2014 at Treefrog HQ, Newmarket, Ontario, Canada
http://www.lassosoft.com/LDC-newmarket-2014

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Can I have JSON formatted data submitted to a Lasso page?

Jonathan Guthrie-3
That's a little strange that the data object is sent quite like that but everyone does things their own way I suppose...

But, what you can do is this:

local(inquiry = map)
with p in web_request->params->asStaticArray
where #p->first->size and not #p->second->size
do => {
        #p->first >> 'inquiry' ? #inquiry = json_deserialize(#p->first)
}

So that's completely untested code, but it should get you going.
There's so many different ways to do this I expect others will pipe up with something too :)

Thanks
Jono


On Aug 23, 2014, at 3:45 PM, Carl Ketterling <[hidden email]> wrote:

> Hey Jono,
>
> Here¹s the information I gathered (I probably should have included this in
> my first post):
>
> If I use ³web_request->raw², I get a map that starts with:
>> CONTENT_LENGTH = 264,
>> CONTENT_TYPE = application/json,
>
> If I use ³action_params², I get this:
>> staticarray(( = ), ({
>>  "inquiry": {
>>    "emailOptions": [
>>      "[hidden email]",
>>      "[hidden email]"
>>    ],
>>    "data": "mydata",
>>    "id": "myid"
>>  }
>> } = ))
>
> Because I don¹t see pairs, and because I see ³CONTENT_TYPE =
> application/json², I thought the data was being sent as a JSON blob.  I
> thought I would be able to find a way to move that blob into something
> suitable for json_deserialize per your document (
> http://jono.guthrie.net.nz/Making-JSON-Simple ).
>
> Can you tell me how to do this?
>
> Carl



Jono

----------------------------
Jonathan Guthrie
[hidden email]
@iamjono
LassoSoft Inc.
AIM Chatroom: lassochat

#############################################################
Attend the Lasso Developer Conference 2014!
October 1-3, 2014 at Treefrog HQ, Newmarket, Ontario, Canada
http://www.lassosoft.com/LDC-newmarket-2014

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Can I have JSON formatted data submitted to a Lasso page?

decorior
This happens when they do something like

$.load(url,{JSON.stringify(myObj)})

as opposed to

$.load(url,{params:JSON.stringify(myObj)})

We have seen this too.

Deco
On Aug 23, 2014, at 2:38 PM, Jonathan Guthrie <[hidden email]> wrote:

> That's a little strange that the data object is sent quite like that but everyone does things their own way I suppose...
>
> But, what you can do is this:
>
> local(inquiry = map)
> with p in web_request->params->asStaticArray
> where #p->first->size and not #p->second->size
> do => {
> #p->first >> 'inquiry' ? #inquiry = json_deserialize(#p->first)
> }
>
> So that's completely untested code, but it should get you going.
> There's so many different ways to do this I expect others will pipe up with something too :)
>
> Thanks
> Jono
>
>
> On Aug 23, 2014, at 3:45 PM, Carl Ketterling <[hidden email]> wrote:
>
>> Hey Jono,
>>
>> Here¹s the information I gathered (I probably should have included this in
>> my first post):
>>
>> If I use ³web_request->raw², I get a map that starts with:
>>> CONTENT_LENGTH = 264,
>>> CONTENT_TYPE = application/json,
>>
>> If I use ³action_params², I get this:
>>> staticarray(( = ), ({
>>> "inquiry": {
>>>   "emailOptions": [
>>>     "[hidden email]",
>>>     "[hidden email]"
>>>   ],
>>>   "data": "mydata",
>>>   "id": "myid"
>>> }
>>> } = ))
>>
>> Because I don¹t see pairs, and because I see ³CONTENT_TYPE =
>> application/json², I thought the data was being sent as a JSON blob.  I
>> thought I would be able to find a way to move that blob into something
>> suitable for json_deserialize per your document (
>> http://jono.guthrie.net.nz/Making-JSON-Simple ).
>>
>> Can you tell me how to do this?
>>
>> Carl
>
>
>
> Jono
>
> ----------------------------
> Jonathan Guthrie
> [hidden email]
> @iamjono
> LassoSoft Inc.
> AIM Chatroom: lassochat
>
> #############################################################
> Attend the Lasso Developer Conference 2014!
> October 1-3, 2014 at Treefrog HQ, Newmarket, Ontario, Canada
> http://www.lassosoft.com/LDC-newmarket-2014
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>

#############################################################
Attend the Lasso Developer Conference 2014!
October 1-3, 2014 at Treefrog HQ, Newmarket, Ontario, Canada
http://www.lassosoft.com/LDC-newmarket-2014

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

RE: Can I have JSON formatted data submitted to a Lasso page?

Rick Draper-2
In reply to this post by Carl Ketterling
Hi Karl,

Try this to catch just the JSON...

local(raw_data) = web_request -> poststring

If(#raw_data -> size > 2) => {
local(data_map) = json_deserialize(#raw_data)
}

VBR

Rick

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Carl Ketterling
Sent: Sunday, 24 August 2014 5:45 AM
To: [hidden email]
Subject: Re: Can I have JSON formatted data submitted to a Lasso page?

Hey Jono,

Here¹s the information I gathered (I probably should have included this in
my first post):

If I use ³web_request->raw², I get a map that starts with:
> CONTENT_LENGTH = 264,
> CONTENT_TYPE = application/json,

If I use ³action_params², I get this:

> staticarray(( = ), ({
>   "inquiry": {
>     "emailOptions": [
>       "[hidden email]",
>       "[hidden email]"
>     ],
>     "data": "mydata",
>     "id": "myid"
>   }
> } = ))

Because I don¹t see pairs, and because I see ³CONTENT_TYPE =
application/json², I thought the data was being sent as a JSON blob.  I
thought I would be able to find a way to move that blob into something
suitable for json_deserialize per your document (
http://jono.guthrie.net.nz/Making-JSON-Simple ).

Can you tell me how to do this?

Carl



From: Jonathan Guthrie <[hidden email]>
Reply-To: <[hidden email]>
Date: Sat, 23 Aug 2014 13:22:05 -0400
To: LassoTalk List <[hidden email]>
Subject: Re: Can I have JSON formatted data submitted to a Lasso page?

Hi Carl,

The data's likely to be coming in as a POST param, so I suggest logging
web_request->params and see what's there, and then treat it as a standard
web request.

On Aug 23, 2014, at 12:43 PM, Carl Ketterling <[hidden email]> wrote:

> I have an app that¹s submitting JSON formatted data to a Lasso 9 page,
> and I can¹t figure out how to get that data into a variable.  Is that
> possible? Or does the data have to be submitted in a matched pair format?
>
> Carl

Jono

----------------------------
Jonathan Guthrie
[hidden email]
@iamjono
LassoSoft Inc.
AIM Chatroom: lassochat

#############################################################
Attend the Lasso Developer Conference 2014!
October 1-3, 2014 at Treefrog HQ, Newmarket, Ontario, Canada
http://www.lassosoft.com/LDC-newmarket-2014

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email] Official list archives
available at http://www.lassotalk.com To unsubscribe, E-mail to:
<[hidden email]>
Send administrative queries to  <[hidden email]>

#############################################################
Attend the Lasso Developer Conference 2014!
October 1-3, 2014 at Treefrog HQ, Newmarket, Ontario, Canada
http://www.lassosoft.com/LDC-newmarket-2014

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email] Official list archives
available at http://www.lassotalk.com To unsubscribe, E-mail to:
<[hidden email]>
Send administrative queries to  <[hidden email]>



#############################################################
Attend the Lasso Developer Conference 2014!
October 1-3, 2014 at Treefrog HQ, Newmarket, Ontario, Canada
http://www.lassosoft.com/LDC-newmarket-2014

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Can I have JSON formatted data submitted to a Lasso page?

Carl Ketterling
Jono,
That information helped me get the task going.  Thank you.

Deco,
Thank you for that information.  I¹ll discuss this with the app developers
to see if this needs to be changed

Rick,
I SWEAR I tried that, but apparently I didn¹t.  That works like a charm.
That¹s really the type of thing I was looking for and couldn¹t find it on
the Lasso reference site.  I just went back there, and it¹s there plain as
day.  That will definitely simplify my code.  Thank you!

Carl


From: Rick Draper <[hidden email]>
Reply-To: <[hidden email]>
Date: Sun, 24 Aug 2014 07:44:51 +1000
To: <[hidden email]>
Subject: RE: Can I have JSON formatted data submitted to a Lasso page?

Hi Karl,

Try this to catch just the JSON...

local(raw_data) = web_request -> poststring

If(#raw_data -> size > 2) => {
local(data_map) = json_deserialize(#raw_data)
}

VBR

Rick

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Carl Ketterling
Sent: Sunday, 24 August 2014 5:45 AM
To: [hidden email]
Subject: Re: Can I have JSON formatted data submitted to a Lasso page?

Hey Jono,

Here¹s the information I gathered (I probably should have included this in
my first post):

If I use ³web_request->raw², I get a map that starts with:
> CONTENT_LENGTH = 264,
> CONTENT_TYPE = application/json,

If I use ³action_params², I get this:

> staticarray(( = ), ({
>   "inquiry": {
>     "emailOptions": [
>       "[hidden email]",
>       "[hidden email]"
>     ],
>     "data": "mydata",
>     "id": "myid"
>   }
> } = ))

Because I don¹t see pairs, and because I see ³CONTENT_TYPE =
application/json², I thought the data was being sent as a JSON blob.  I
thought I would be able to find a way to move that blob into something
suitable for json_deserialize per your document (
http://jono.guthrie.net.nz/Making-JSON-Simple ).

Can you tell me how to do this?

Carl



From: Jonathan Guthrie <[hidden email]>
Reply-To: <[hidden email]>
Date: Sat, 23 Aug 2014 13:22:05 -0400
To: LassoTalk List <[hidden email]>
Subject: Re: Can I have JSON formatted data submitted to a Lasso page?

Hi Carl,

The data's likely to be coming in as a POST param, so I suggest logging
web_request->params and see what's there, and then treat it as a standard
web request.

On Aug 23, 2014, at 12:43 PM, Carl Ketterling <[hidden email]> wrote:

> I have an app that¹s submitting JSON formatted data to a Lasso 9 page,
> and I can¹t figure out how to get that data into a variable.  Is that
> possible? Or does the data have to be submitted in a matched pair format?
>
> Carl

Jono

----------------------------
Jonathan Guthrie
[hidden email]
@iamjono
LassoSoft Inc.
AIM Chatroom: lassochat

#############################################################
Attend the Lasso Developer Conference 2014!
October 1-3, 2014 at Treefrog HQ, Newmarket, Ontario, Canada
http://www.lassosoft.com/LDC-newmarket-2014

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email] Official list archives
available at http://www.lassotalk.com To unsubscribe, E-mail to:
<[hidden email]>
Send administrative queries to  <[hidden email]>

#############################################################
Attend the Lasso Developer Conference 2014!
October 1-3, 2014 at Treefrog HQ, Newmarket, Ontario, Canada
http://www.lassosoft.com/LDC-newmarket-2014

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email] Official list archives
available at http://www.lassotalk.com To unsubscribe, E-mail to:
<[hidden email]>
Send administrative queries to  <[hidden email]>



#############################################################
Attend the Lasso Developer Conference 2014!
October 1-3, 2014 at Treefrog HQ, Newmarket, Ontario, Canada
http://www.lassosoft.com/LDC-newmarket-2014

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>

#############################################################
Attend the Lasso Developer Conference 2014!
October 1-3, 2014 at Treefrog HQ, Newmarket, Ontario, Canada
http://www.lassosoft.com/LDC-newmarket-2014

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

RE: Can I have JSON formatted data submitted to a Lasso page?

Rick Draper-2
> That will definitely simplify my code.  Thank you!

You are most welcome. As it happens I spent a chunk of yesterday on this
very subject after a very long time not writing any code - in my case
dealing with up to 6k of JSON data.

VBR

Rick


#############################################################
Attend the Lasso Developer Conference 2014!
October 1-3, 2014 at Treefrog HQ, Newmarket, Ontario, Canada
http://www.lassosoft.com/LDC-newmarket-2014

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>