Hi Sergio,

You probably overlooked the option to add a mapping to the class side. Check 
the implementors of #neoJsonMapping:

In your case, all you have to do is add the following method.

RadioStation class>>#neoJsonMapping: mapper
  mapper for: self do: [ :mapping | mapping mapInstVars ]

I can't help you with Teapot though. Legal JSON is legal JSON, that is what 
NeoJSON produces.

Sven

> On 27 Jan 2017, at 22:46, sergio ruiz <sergio....@gmail.com> wrote:
> 
> 
> Okay, I am having the worst time with this..
> 
> i have a class called RadioStation that for now, just had  few text instance 
> variables.
> 
> all I really need to do is turn this into JSON..
> 
> i can do it with something like:
> 
> String streamContents: [ :stream |
>    (NeoJSONWriter on: stream)
>       prettyPrint: true;
>       mapInstVarsFor: RadioStation;
>       nextPut: (RadioStation SelectAll last) ]. 
>       
> but this seems like massive overkill.. plus, very soon, this is going to have 
> collections of other objects..
> 
> also, since this returns a string.. when Teapot returns this, it escapes all 
> of the “s and produces illegal json, as it’s just a string..
> 
> i read about mappers, but i can’t figure out how to create them..
> 
> doing something simple like:
> 
> | mapper server |
> mapper := NeoJSONMapper new.
> 
> mapper mapAllInstVarsFor: RadioStation.
> mapper mappings.
> 
> NeoJSONWriter toString: station.
> 
> which feels like it should work, gives me:
> 
> No mapping found for RadioStation in NeoJSONWriter
> 
> any help?
> 
> thanks so much!
> 
> ----
> peace,
> sergio
> photographer, journalist, visionary
> 
> Public Key: http://bit.ly/29z9fG0
> #BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
> http://www.Village-Buzz.com
> http://www.ThoseOptimizeGuys.com
> http://www.coffee-black.com
> http://www.painlessfrugality.com
> http://www.twitter.com/sergio_101
> http://www.facebook.com/sergio101


Reply via email to