Ah sorry, I'm blind.

Yes, ideally it should throw up an error in case of recursive.
And I see that NeoJSON runs into infinite cycle, so I guess this should be
addressed there too.



On Tue, Mar 27, 2018 at 6:41 PM, Herbert Vojčík <he...@mailbox.sk> wrote:

>
>
> Peter Uhnák wrote:
>
>> Hi Sven,
>>
>> shouldn't it be set to #ignore by default for JSON then? Or is there a
>> use case where it makes sense to have something else for JSON?
>>
>
> To keep STON practices / assumptions while using JSON to hold the data
> where STON is not supported yet, maybe? IIRC STON is positioning itself as
> JSON superset; but maybe only syntactic superset, while semantically it can
> be a bit different (so STONize to more low-level, JSON, syntax via STON;
> JSONize faithfully to JSON semantics using NeoJSON; but maybe I am just
> making things up).
>
> Herbert: I am not talking about (infinitely) recursive references, but
>>
>
> I know; Sven explicitly asked what to do with cycles in that case, though.
>
> referencing the same object, e.g.
>>
>>
>> Peter
>>
>> On Tue, Mar 27, 2018 at 6:08 PM, Herbert Vojčík <he...@mailbox.sk
>> <mailto:he...@mailbox.sk>> wrote:
>>
>>
>>
>>     Sven Van Caekenberghe wrote:
>>
>>         Hi Peter,
>>
>>         Both cases will pass using this expression:
>>
>>         String streamContents: [ :out |
>>                  STON jsonWriter
>>                          referencePolicy: #ignore;
>>                          on: out;
>>                          nextPut: d ].
>>
>>         The problem is what to do with cycles.
>>
>>
>>     Be faithful to what JSON.stringify does in JS. See attachment. :-)
>>
>>     Herby
>>
>>
>>         Sven
>>
>>             On 27 Mar 2018, at 17:43, Peter Uhnák<i.uh...@gmail.com
>>             <mailto:i.uh...@gmail.com>>  wrote:
>>
>>             Hi,
>>
>>             I don't think this should throw an error when I am producing
>>             JSON.
>>
>>             ```
>>             d := {
>>             'a' ->  #().
>>             'b' ->  #().
>>             } asDictionary.
>>
>>             STON toJsonString: d.
>>             ```
>>
>>             dtto this
>>
>>             ```
>>             a := {'hm'}.
>>
>>             d := {
>>             'a' ->  a.
>>             'b' ->  a.
>>             } asDictionary.
>>
>>             STON toJsonString: d.
>>             ```
>>
>>             Maybe I should forgo using STON>>toJson* out of laziness (it
>>             is preinstalled) and always go for NeoJSON?
>>
>>             Peter
>>
>>
>>
>>
>>
>

Reply via email to