parsing json in a projection

​When you wrote the events did you set IsJson? If not we won’t try to deserialise them and will just give you them as a string. However, if JSON.parse is failing it sounds like you might actually have invalid JSON?

James

IsJson equals true when writing the events.
Example event data: [{“Price”:531,“Ticker”:“foo”},{“Price”:1494,“Ticker”:“bar”}]

But event.data is a string in the event handler…

I must be serializing the wrong way? I’m usingJson.net

If i wrap my array in an object, event store manages to deserialize it for me… :slight_smile:

are you setting IsJson=true on EventData (c#)? Are you writing valid json

[{“Price”:531,“Ticker”:“foo”},{“Price”:1494,“Ticker”:“bar”}]

or invalid json?

[{Price:531,Ticker:“foo”},{Price:1494,Ticker:“bar”}]

Json.net is doing the serialization for me, so it’s valid…

If i serialize an array containing objects, event store gives me back a string.

If i wrap the same array in an object where the array is assigned to a property, event store gives me back a javascript object with a property containing an array, as expected.

and yes, IsJson=true

I think it needs to be an object base

I can confirm that..
It would be a better experience if it failed earlier instead..?

This small issue along with the UI given one the impression that projections are available even though --run-projections=all haven't been specified from the commandline, have cost us some time..

Otherwhise a very good impression of projections so far :slight_smile:

The default on the dev branch now is to hide the UI if projections aren't available, and the default is None instead of System.

That's great, it will safe some time for people.