JSON serialization of dictionary broken in Seaside 3.1?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

JSON serialization of dictionary broken in Seaside 3.1?

Mariano Martinez Peck
Hi guys, I am trying to migrate my app from Seaside 3.0.9 to seaside 3.1.3 and I am having a problem with JQAutocomplete. The problem is in #search:labels:callback:. Basically, I am not able to serialize via JSON what I was indeed able before. It seems the json serialization changed in seaside 3.1 as I can read in the changelog. I have reproduced the problem up to this snipet:

| dict stream |
dict := GRSmallDictionary new.
dict at: 'label' put: 'NONE'.
dict at: 'index'put: 1.
stream := GRPharoUtf8CodecStream 
on: String new writeStream
converter: UTF8TextConverter new.
stream json: dict.

Anyone has an insigh of which should be the correct solution?

Thanks

--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: JSON serialization of dictionary broken in Seaside 3.1?

Philippe Marschall
On Tue, Oct 14, 2014 at 4:06 PM, Mariano Martinez Peck
<[hidden email]> wrote:

> Hi guys, I am trying to migrate my app from Seaside 3.0.9 to seaside 3.1.3
> and I am having a problem with JQAutocomplete. The problem is in
> #search:labels:callback:. Basically, I am not able to serialize via JSON
> what I was indeed able before. It seems the json serialization changed in
> seaside 3.1 as I can read in the changelog. I have reproduced the problem up
> to this snipet:
>
> | dict stream |
> dict := GRSmallDictionary new.
> dict at: 'label' put: 'NONE'.
> dict at: 'index'put: 1.
> stream := GRPharoUtf8CodecStream
> on: String new writeStream
> converter: UTF8TextConverter new.
> stream json: dict.
>
> Anyone has an insigh of which should be the correct solution?

"Works for me" I get
{"label": "NONE", "index": 1}
what do you get?

Can you check #jsonOn: on Dictionary and GRSmallDictionary? It could
be a loading issue. The methods have been moved around to different
packages.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: JSON serialization of dictionary broken in Seaside 3.1?

Mariano Martinez Peck


On Tue, Oct 14, 2014 at 4:40 PM, Philippe Marschall <[hidden email]> wrote:
On Tue, Oct 14, 2014 at 4:06 PM, Mariano Martinez Peck
<[hidden email]> wrote:
> Hi guys, I am trying to migrate my app from Seaside 3.0.9 to seaside 3.1.3
> and I am having a problem with JQAutocomplete. The problem is in
> #search:labels:callback:. Basically, I am not able to serialize via JSON
> what I was indeed able before. It seems the json serialization changed in
> seaside 3.1 as I can read in the changelog. I have reproduced the problem up
> to this snipet:
>
> | dict stream |
> dict := GRSmallDictionary new.
> dict at: 'label' put: 'NONE'.
> dict at: 'index'put: 1.
> stream := GRPharoUtf8CodecStream
> on: String new writeStream
> converter: UTF8TextConverter new.
> stream json: dict.
>
> Anyone has an insigh of which should be the correct solution?

"Works for me" I get
{"label": "NONE", "index": 1}
what do you get?


I get 'Override #jsonOn: to make the receiver serializeable as JSON'
 
Can you check #jsonOn: on Dictionary and GRSmallDictionary? It could
be a loading issue. The methods have been moved around to different
packages.


Dictionary >> jsonOn: aRenderer
aRenderer object: [
self keysAndValuesDo: [ :key :value |
aRenderer key: key value: value ] ] 

GRSmallDictionary >> jsonOn: aRenderer
aRenderer object: [
self keysAndValuesDo: [ :key :value |
aRenderer key: key value: value ] ]

See the attached screenshot. Maybe I can share a fueled out stack?

 
Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Screen Shot 2014-10-14 at 4.47.30 PM.png (117K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: JSON serialization of dictionary broken in Seaside 3.1?

Mariano Martinez Peck
Ok. I found the problem. For seaside 3.0.9 I was loading these:

spec
project: 'Seaside' with: [
spec
className: 'ConfigurationOfSeaside3';
loads: #('Core' 'Javascript-Core' 'JQuery-Core');
file: 'ConfigurationOfSeaside3';
].

But for Seaside 3.1 it should have been:


spec
project: 'Seaside' with: [
spec
className: 'ConfigurationOfSeaside3';
loads: #('Core' 'Zinc-Seaside' 'Javascript' 'JQuery' 'JSON');
file: 'ConfigurationOfSeaside3';
 ].


Basically....use the groups rather than individual packages. Clearly, I was missing some package...

Thanks!


On Tue, Oct 14, 2014 at 4:48 PM, Mariano Martinez Peck <[hidden email]> wrote:


On Tue, Oct 14, 2014 at 4:40 PM, Philippe Marschall <[hidden email]> wrote:
On Tue, Oct 14, 2014 at 4:06 PM, Mariano Martinez Peck
<[hidden email]> wrote:
> Hi guys, I am trying to migrate my app from Seaside 3.0.9 to seaside 3.1.3
> and I am having a problem with JQAutocomplete. The problem is in
> #search:labels:callback:. Basically, I am not able to serialize via JSON
> what I was indeed able before. It seems the json serialization changed in
> seaside 3.1 as I can read in the changelog. I have reproduced the problem up
> to this snipet:
>
> | dict stream |
> dict := GRSmallDictionary new.
> dict at: 'label' put: 'NONE'.
> dict at: 'index'put: 1.
> stream := GRPharoUtf8CodecStream
> on: String new writeStream
> converter: UTF8TextConverter new.
> stream json: dict.
>
> Anyone has an insigh of which should be the correct solution?

"Works for me" I get
{"label": "NONE", "index": 1}
what do you get?


I get 'Override #jsonOn: to make the receiver serializeable as JSON'
 
Can you check #jsonOn: on Dictionary and GRSmallDictionary? It could
be a loading issue. The methods have been moved around to different
packages.


Dictionary >> jsonOn: aRenderer
aRenderer object: [
self keysAndValuesDo: [ :key :value |
aRenderer key: key value: value ] ] 

GRSmallDictionary >> jsonOn: aRenderer
aRenderer object: [
self keysAndValuesDo: [ :key :value |
aRenderer key: key value: value ] ]

See the attached screenshot. Maybe I can share a fueled out stack?

 
Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



--
Mariano
http://marianopeck.wordpress.com



--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: JSON serialization of dictionary broken in Seaside 3.1?

Stephan Eggermont-3
In reply to this post by Mariano Martinez Peck
Mariano wrote:
>loads: #('Core' 'Zinc-Seaside' 'Javascript' 'JQuery' 'JSON');

'Javascript' should not be needed there, I assume.

Stephan

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: JSON serialization of dictionary broken in Seaside 3.1?

Philippe Marschall
On Thu, Oct 16, 2014 at 12:40 AM, Stephan Eggermont <[hidden email]> wrote:
> Mariano wrote:
>>loads: #('Core' 'Zinc-Seaside' 'Javascript' 'JQuery' 'JSON');
>
> 'Javascript' should not be needed there, I assume.

JQuery should trigger Javascript.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside