Deserialize list JSON with no root/association name

I'm trying to deserialize the following JSON: {    "Product Name 1": {       "layout": "normal",       "name": "Product Name 1",       "cmc": 5,       "colors": [          "Blue"       ],       "type": "Type 1"    },    "Product name 2": {       "layout": "normal",       "name": "Product Name 2",       "cmc": 5,       "colors": [          "Red",          "Blue"       ],       "type": "Type 2"    } } It's a (simplified) list of thousands of products, but this is the the way that I receive it. I've looked at other JSON deserialize suggestions posted on the forums (for example: But compared to this one I seem to be missing the ("items": {) part. Is this problematic or is there a way around this?
1 answers

I believe this is improper JSON. It should be giving you a list of objects. If you can't have it fixed on the other end, I would look at using a regular expression replaceAll to correct it, then using the regular deserializer. You could do this by first simply replacing:

  • The first { with "products": [
  • The last } with ]

Then, using a regular expression, I think you need to replace each instance of:

"Product Name 1": {


   "name": "Product Name 1",

I think that should set you up with properly formatted JSON. The regular expression is the tricky piece but definitely possible.

EDIT: for the example code you posted, you can achieve the find/replace using these parameters. You can do this either using a text editor like notepadd++ (one time use), or using the Mendix ReplaceAll function:

  • Regular expression to match:

\n "[A-Za-z0-9 ]+":

  • Replacement string:


Note that both the regex string and replacement string should have 3 spaces after the newline character.