On May 6, 2012, at 6:30 PM, Dale Henrichs wrote: > Larry, > > `'JSON.stringify("Login Succeeded")'` looks like the javascript code that will generate the JSON when executed in the browser. > > There's a Seaside-JSON-Core package available that allows you to build a JSON-based response to a RESTful seaside request (so you can return JSON instead of HTML) in a Seaside style, i.e., #renderJsonOn:… > Thanks, Dale. I'm having trouble finding that package. Is it here: http://www.squeaksource.com/Seaside30 ? Larry > If you're using Seaside in your app then leveraging the explicit JSON support is a good way to go... > > Dale > > ----- Original Message ----- > | From: "Lawrence Kellogg" <[hidden email]> > | To: "GemStone Seaside beta discussion" <[hidden email]> > | Sent: Sunday, May 6, 2012 11:00:53 AM > | Subject: [GS/SS Beta] JSON Question > | > | Hello, > | So, I want to use JSON to return objects from Gemstone. I'm new to > | JSON so bear with me. > | If I define, > | > | json > | ^ JSJson context: self renderContext > | > | and > | > | renderContext > | "Answer a fake rendering context for this pusher." > | > | ^ WARenderContext new > | document: (WAHtmlDocument on: (WriteStream on: String new)); > | actionUrl: WAUrl new; > | yourself > | > | in a subclass of WAComponent > | > | and then do > | > | (self json stringify: 'Login Succeeded') greaseString > | > | I get this: > | > | 'JSON.stringify("Login Succeeded")' > | > | Is this really what a JSON client would be able to decode? Seems > | wrong to me. > | Which JSON package should I use in Gemstone? I'm using the > | Javascript-Core-JSON package. > | > | Any help would be appreciated. > | > | Regards, > | > | Larry > | > | P.S. By the way, the client will not be written in Smalltalk, so I > | assume STON is not what I want, but I don't really know. > | |
On May 6, 2012, at 9:24 PM, Lawrence Kellogg wrote:
Found it, here:
|
On May 6, 2012, at 9:59 PM, Lawrence Kellogg wrote:
Larry
|
In reply to this post by Larry Kellogg
On Sun, May 6, 2012 at 10:25 PM, Lawrence Kellogg <[hidden email]> wrote:
> > > Sent from my iPhone > > > On May 6, 2012, at 4:09 PM, Philippe Marschall > <[hidden email]> wrote: > > On Sun, May 6, 2012 at 8:00 PM, Lawrence Kellogg <[hidden email]> wrote: > > Hello, > > So, I want to use JSON to return objects from Gemstone. I'm new to JSON so > bear with me. > > If I define, > > > json > > ^ JSJson context: self renderContext > > > and > > > renderContext > > "Answer a fake rendering context for this pusher." > > > ^ WARenderContext new > > document: (WAHtmlDocument on: (WriteStream on: String new)); > > actionUrl: WAUrl new; > > yourself > > > in a subclass of WAComponent > > > and then do > > > (self json stringify: 'Login Succeeded') greaseString > > > I get this: > > > 'JSON.stringify("Login Succeeded")' > > > Is this really what a JSON client would be able to decode? Seems wrong to > me. > > Which JSON package should I use in Gemstone? I'm using the > Javascript-Core-JSON package. > > > Any help would be appreciated. > > > Can you provide a bit more information about the application you're > > going to write? Does the server just return JSON or will it return > > mostly HTML and JSON just in one place? > > > > Well, the services layer of my application will just return JSON, not > HTML. > > > > > Which programming model are you looking for? > > - Do you want the traditional Seaside component model where a > > response is made up of rendering all the visible components. Where you > > have WATakss and components can #call: and #answer: and you have > > "ugly" URLs. > > - Is the application more a web service style where it's important to > > have nice and clean URLs and you don't have complex interaction. > > > > > Yes, the app is more of a web service style and not something that will > render components as a response. My JSON responses will be simple strings > and numbers, for the most part. In that case Seaside-REST [1] is probably the better approach than components. And then you can simply send #asJson to the result. #('Login Succeeded') asJson Keep in mind that top level JSON elements should be sequenceable collections or dictionaries. [1] http://book.seaside.st/book/advanced/restful Cheers Philippe |
On May 7, 2012, at 2:04 AM, Philippe Marschall wrote: > On Sun, May 6, 2012 at 10:25 PM, Lawrence Kellogg <[hidden email]> wrote: >> >> >> Sent from my iPhone >> >> >> On May 6, 2012, at 4:09 PM, Philippe Marschall >> <[hidden email]> wrote: >> >> On Sun, May 6, 2012 at 8:00 PM, Lawrence Kellogg <[hidden email]> wrote: >> >> Hello, >> >> So, I want to use JSON to return objects from Gemstone. I'm new to JSON so >> bear with me. >> >> If I define, >> >> >> json >> >> ^ JSJson context: self renderContext >> >> >> and >> >> >> renderContext >> >> "Answer a fake rendering context for this pusher." >> >> >> ^ WARenderContext new >> >> document: (WAHtmlDocument on: (WriteStream on: String new)); >> >> actionUrl: WAUrl new; >> >> yourself >> >> >> in a subclass of WAComponent >> >> >> and then do >> >> >> (self json stringify: 'Login Succeeded') greaseString >> >> >> I get this: >> >> >> 'JSON.stringify("Login Succeeded")' >> >> >> Is this really what a JSON client would be able to decode? Seems wrong to >> me. >> >> Which JSON package should I use in Gemstone? I'm using the >> Javascript-Core-JSON package. >> >> >> Any help would be appreciated. >> >> >> Can you provide a bit more information about the application you're >> >> going to write? Does the server just return JSON or will it return >> >> mostly HTML and JSON just in one place? >> >> >> >> Well, the services layer of my application will just return JSON, not >> HTML. >> >> >> >> >> Which programming model are you looking for? >> >> - Do you want the traditional Seaside component model where a >> >> response is made up of rendering all the visible components. Where you >> >> have WATakss and components can #call: and #answer: and you have >> >> "ugly" URLs. >> >> - Is the application more a web service style where it's important to >> >> have nice and clean URLs and you don't have complex interaction. >> >> >> >> >> Yes, the app is more of a web service style and not something that will >> render components as a response. My JSON responses will be simple strings >> and numbers, for the most part. > > In that case Seaside-REST [1] is probably the better approach than > components. And then you can simply send #asJson to the result. > > #('Login Succeeded') asJson > > Keep in mind that top level JSON elements should be sequenceable > collections or dictionaries. > > [1] http://book.seaside.st/book/advanced/restful > Thanks, Philippe, this sounds good, except I am still trying to figure out how to load this into my Gemstone 2.4.4.1 image. I seem to have to pull code from the Seaside31 repository. Is there an easier way? Also, from what I gather from James, there is no Gemstone parsing JSON parsing solution, at the moment, is that correct? Larry > Cheers > Philippe |
I seem to be missing the method for initializeOn: in
WATableBasedEncoder>>initializeOn: aStream table: anArray self initializeOn: aStream. table := anArray Anybody know what it is? Does this WATableBasedEncoder work? Larry On May 7, 2012, at 8:25 AM, Lawrence Kellogg wrote: > > On May 7, 2012, at 2:04 AM, Philippe Marschall wrote: > >> On Sun, May 6, 2012 at 10:25 PM, Lawrence Kellogg <[hidden email]> wrote: >>> >>> >>> Sent from my iPhone >>> >>> >>> On May 6, 2012, at 4:09 PM, Philippe Marschall >>> <[hidden email]> wrote: >>> >>> On Sun, May 6, 2012 at 8:00 PM, Lawrence Kellogg <[hidden email]> wrote: >>> >>> Hello, >>> >>> So, I want to use JSON to return objects from Gemstone. I'm new to JSON so >>> bear with me. >>> >>> If I define, >>> >>> >>> json >>> >>> ^ JSJson context: self renderContext >>> >>> >>> and >>> >>> >>> renderContext >>> >>> "Answer a fake rendering context for this pusher." >>> >>> >>> ^ WARenderContext new >>> >>> document: (WAHtmlDocument on: (WriteStream on: String new)); >>> >>> actionUrl: WAUrl new; >>> >>> yourself >>> >>> >>> in a subclass of WAComponent >>> >>> >>> and then do >>> >>> >>> (self json stringify: 'Login Succeeded') greaseString >>> >>> >>> I get this: >>> >>> >>> 'JSON.stringify("Login Succeeded")' >>> >>> >>> Is this really what a JSON client would be able to decode? Seems wrong to >>> me. >>> >>> Which JSON package should I use in Gemstone? I'm using the >>> Javascript-Core-JSON package. >>> >>> >>> Any help would be appreciated. >>> >>> >>> Can you provide a bit more information about the application you're >>> >>> going to write? Does the server just return JSON or will it return >>> >>> mostly HTML and JSON just in one place? >>> >>> >>> >>> Well, the services layer of my application will just return JSON, not >>> HTML. >>> >>> >>> >>> >>> Which programming model are you looking for? >>> >>> - Do you want the traditional Seaside component model where a >>> >>> response is made up of rendering all the visible components. Where you >>> >>> have WATakss and components can #call: and #answer: and you have >>> >>> "ugly" URLs. >>> >>> - Is the application more a web service style where it's important to >>> >>> have nice and clean URLs and you don't have complex interaction. >>> >>> >>> >>> >>> Yes, the app is more of a web service style and not something that will >>> render components as a response. My JSON responses will be simple strings >>> and numbers, for the most part. >> >> In that case Seaside-REST [1] is probably the better approach than >> components. And then you can simply send #asJson to the result. >> >> #('Login Succeeded') asJson >> >> Keep in mind that top level JSON elements should be sequenceable >> collections or dictionaries. >> >> [1] http://book.seaside.st/book/advanced/restful >> > > Thanks, Philippe, this sounds good, except I am still trying to figure out how > to load this into my Gemstone 2.4.4.1 image. I seem to have to pull code from the Seaside31 repository. > Is there an easier way? > > Also, from what I gather from James, there is no Gemstone parsing JSON parsing solution, at the moment, is that correct? > > Larry > > > > >> Cheers >> Philippe > |
In reply to this post by Larry Kellogg
Seaside has a JSON parser: JSJsonParser in Javascript-Core-JSON and it functions in GemStone ... STON also parses JSON and it has been ported to GemStone ...
ConfigurationOfSeasideRest in http://www.squeaksource.com/MetacelloRepository has been ported to GemStone. ConfigurationOfSeasideJSON in http://www.squeaksource.com/MetacelloRepository has been ported to GemStone, but it looks like some of the package have been deleted or moved ... Philippe can probably tell you where to find them and we should update the configuration ... if you are desperate, I have copies of the missing packages that I can supply you ... Appears that the most recent JSON Seaside code is now dependent upon Seaside3.1 (not ported to GemStone)... but the early versions that I was using worked just fine for my purposes... Dale ----- Original Message ----- | From: "Lawrence Kellogg" <[hidden email]> | To: "GemStone Seaside beta discussion" <[hidden email]> | Sent: Monday, May 7, 2012 5:25:10 AM | Subject: Re: [GS/SS Beta] JSON Question | | | On May 7, 2012, at 2:04 AM, Philippe Marschall wrote: | | > On Sun, May 6, 2012 at 10:25 PM, Lawrence Kellogg <[hidden email]> | > wrote: | >> | >> | >> Sent from my iPhone | >> | >> | >> On May 6, 2012, at 4:09 PM, Philippe Marschall | >> <[hidden email]> wrote: | >> | >> On Sun, May 6, 2012 at 8:00 PM, Lawrence Kellogg <[hidden email]> | >> wrote: | >> | >> Hello, | >> | >> So, I want to use JSON to return objects from Gemstone. I'm new to | >> JSON so | >> bear with me. | >> | >> If I define, | >> | >> | >> json | >> | >> ^ JSJson context: self renderContext | >> | >> | >> and | >> | >> | >> renderContext | >> | >> "Answer a fake rendering context for this pusher." | >> | >> | >> ^ WARenderContext new | >> | >> document: (WAHtmlDocument on: (WriteStream on: | >> String new)); | >> | >> actionUrl: WAUrl new; | >> | >> yourself | >> | >> | >> in a subclass of WAComponent | >> | >> | >> and then do | >> | >> | >> (self json stringify: 'Login Succeeded') greaseString | >> | >> | >> I get this: | >> | >> | >> 'JSON.stringify("Login Succeeded")' | >> | >> | >> Is this really what a JSON client would be able to decode? Seems | >> wrong to | >> me. | >> | >> Which JSON package should I use in Gemstone? I'm using the | >> Javascript-Core-JSON package. | >> | >> | >> Any help would be appreciated. | >> | >> | >> Can you provide a bit more information about the application | >> you're | >> | >> going to write? Does the server just return JSON or will it return | >> | >> mostly HTML and JSON just in one place? | >> | >> | >> | >> Well, the services layer of my application will just return JSON, | >> not | >> HTML. | >> | >> | >> | >> | >> Which programming model are you looking for? | >> | >> - Do you want the traditional Seaside component model where a | >> | >> response is made up of rendering all the visible components. Where | >> you | >> | >> have WATakss and components can #call: and #answer: and you have | >> | >> "ugly" URLs. | >> | >> - Is the application more a web service style where it's important | >> to | >> | >> have nice and clean URLs and you don't have complex interaction. | >> | >> | >> | >> | >> Yes, the app is more of a web service style and not something | >> that will | >> render components as a response. My JSON responses will be simple | >> strings | >> and numbers, for the most part. | > | > In that case Seaside-REST [1] is probably the better approach than | > components. And then you can simply send #asJson to the result. | > | > #('Login Succeeded') asJson | > | > Keep in mind that top level JSON elements should be sequenceable | > collections or dictionaries. | > | > [1] http://book.seaside.st/book/advanced/restful | > | | Thanks, Philippe, this sounds good, except I am still trying to | figure out how | to load this into my Gemstone 2.4.4.1 image. I seem to have to pull | code from the Seaside31 repository. | Is there an easier way? | | Also, from what I gather from James, there is no Gemstone parsing | JSON parsing solution, at the moment, is that correct? | | Larry | | | | | > Cheers | > Philippe | | |
On Mon, May 7, 2012 at 6:24 PM, Dale Henrichs <[hidden email]> wrote:
> Seaside has a JSON parser: JSJsonParser in Javascript-Core-JSON and it functions in GemStone ... STON also parses JSON and it has been ported to GemStone ... > > ConfigurationOfSeasideRest in http://www.squeaksource.com/MetacelloRepository has been ported to GemStone. > > ConfigurationOfSeasideJSON in http://www.squeaksource.com/MetacelloRepository has been ported to GemStone, but it looks like some of the package have been deleted or moved ... Philippe can probably tell you where to find them and we should update the configuration ... if you are desperate, I have copies of the missing packages that I can supply you ... > > Appears that the most recent JSON Seaside code is now dependent upon Seaside3.1 (not ported to GemStone)... but the early versions that I was using worked just fine for my purposes... I feel that Javascript-Core form Seaside 3.0 should be enough for Larry's use case. #asJson, #jsonOn: and JSJsonParser are all there. The only thing missing is the canvas support. It sounded to me as if his use case war fairly simple so this shouldn't be an issue. Cheers Philippe |
On May 7, 2012, at 1:01 PM, Philippe Marschall wrote: > On Mon, May 7, 2012 at 6:24 PM, Dale Henrichs <[hidden email]> wrote: >> Seaside has a JSON parser: JSJsonParser in Javascript-Core-JSON and it functions in GemStone ... STON also parses JSON and it has been ported to GemStone ... >> >> ConfigurationOfSeasideRest in http://www.squeaksource.com/MetacelloRepository has been ported to GemStone. >> >> ConfigurationOfSeasideJSON in http://www.squeaksource.com/MetacelloRepository has been ported to GemStone, but it looks like some of the package have been deleted or moved ... Philippe can probably tell you where to find them and we should update the configuration ... if you are desperate, I have copies of the missing packages that I can supply you ... >> >> Appears that the most recent JSON Seaside code is now dependent upon Seaside3.1 (not ported to GemStone)... but the early versions that I was using worked just fine for my purposes... > > I feel that Javascript-Core form Seaside 3.0 should be enough for > Larry's use case. #asJson, #jsonOn: and JSJsonParser are all there. > The only thing missing is the canvas support. It sounded to me as if > his use case war fairly simple so this shouldn't be an issue. Yes, I think the simple case will be enough for now, although you have given me some ideas when you mentioned canvas support. I'll try to get this working…. Larry > > Cheers > Philippe |
Free forum by Nabble | Edit this page |