Skip to content
This repository has been archived by the owner on Jun 26, 2021. It is now read-only.

When a map is used JSON serialization is wrong #74

Closed
tarelli opened this issue Dec 9, 2015 · 9 comments
Closed

When a map is used JSON serialization is wrong #74

tarelli opened this issue Dec 9, 2015 · 9 comments
Labels
Milestone

Comments

@tarelli
Copy link

tarelli commented Dec 9, 2015

We have an ecore with one reference named "initialValue" that is a map, here is a screenshot of the ecore:
screen shot 2015-12-09 at 15 07 52

When such reference is serialized the following JSON is produced:

                "id": "g",
                "name": "g",
                "types": [{
                    "$ref": "//@libraries.1/@types.2"
                }],
                "initialValues": {: {

The problem is the double :{ :{ the second colon is unexpected.
Uncaught SyntaxError: Unexpected token :

@ghillairet ghillairet added the bug label Dec 9, 2015
@ghillairet ghillairet added this to the 0.14 milestone Dec 9, 2015
@tarelli
Copy link
Author

tarelli commented Dec 10, 2015

@ghillairet do you have a tentative due date for 0.14? Trying to decide the best course of action around this, thanks!

@ghillairet
Copy link
Member

The fix for this one will be in maven snapshot repository today or tomorrow.

For maps that don't have keys of type string the serialization will look like that

{
  "eClass" : "http://www.emfjson.org/jackson/model#//ETypes",
  "values" : [ {
    "key" : {
      "eClass" : "http://www.emfjson.org/jackson/model#//Type",
      "name" : "t1"
    },
    "value" : {
      "eClass" : "http://www.emfjson.org/jackson/model#//Value",
      "value" : 1
    }
  }, {
    "key" : {
      "eClass" : "http://www.emfjson.org/jackson/model#//Type",
      "name" : "t2"
    },
    "value" : {
      "eClass" : "http://www.emfjson.org/jackson/model#//Value",
      "value" : 2
    }
  } ]
}

A map with keys being string is serialized like that

{
  "eClass" : "http://www.emfjson.org/jackson/model#//ETypes",
  "values" : {
     "t1": 1,
     "t2": 2 
  }
}

@tarelli
Copy link
Author

tarelli commented Dec 10, 2015

@ghillairet great, thanks Guillaume!

@tarelli
Copy link
Author

tarelli commented Dec 15, 2015

@ghillairet hi Guillaume, any update on release 0.1.4? Thanks!

@ghillairet
Copy link
Member

I won't have time before next week, due to the move to the organization I have to re-setup the build for the eclipse update site.

@tarelli
Copy link
Author

tarelli commented Dec 28, 2015

@ghillairet let me know if there's anything I can do to help :)

ghillairet added a commit that referenced this issue Dec 30, 2015
@ghillairet
Copy link
Member

0.14 has been released (https://github.com/emfjson/emfjson-jackson/releases/tag/0.14.0) and includes fix for this issue.

@tarelli
Copy link
Author

tarelli commented Mar 22, 2016

@ghillairet if the key is not contained in the map should there be a reference instead of the whole object?

@ghillairet
Copy link
Member

Yes you're right, see #83

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants