Quantcast
Channel: Northwoods Software - Latest topics
Viewing all articles
Browse latest Browse all 7420

JSON serialization of Date objects

$
0
0

@Dominic.Lerbs wrote:

Hi,

I have a question about the JSON serialization of JavaScript Date objects:

saving a Date object in the nodeDataArray and serializing it to JSON will persist the date as an obejct:

"birthDate":{"class":"Date", "value":"2017-01-27T16:56:29.301Z"}

while the default JSON.stringify method will produce a simple string value:
"birthDate":"2017-01-27T16:56:29.301Z"

See here for a live example: http://jsfiddle.net/q8hkxg36/1/

Can I influence how goJS converts to Date to JSON? I would prefer to serialize it to a string instead of an object.
As I am not directly using this value in the goJS diagram (using it in another part of the application) but only want to persist it in the model, I assume I cannot use bindings for this purpose? Is there another way?

I am using goJS 1.7 beta.

Best regards,
Dominic

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7420

Trending Articles