How to put a hash/object array into notes?

I'm trying to do something like this in a note box:

Code:
colours = ["yellow":1,
          "blue":2,
           "red":3]

so that when metadata is loaded, I can refer to them as object.meta.colours.yellow or object.meta.colours["yellow"].

I've tried to set them up the way DataManager sets up the $dataxxx objects, but it's just giving me a long string back as the meta content.

Is there a way to do this so it just works, or will I need to write an addon to the extractMetadata function to change them into the desired format?
you use bad syntaxe.
for object syxtaxe its like thats.
PHP:
var color = {yellow:1,blue:2,red:3};

if i understand you have string
you can use parse

PHP:
var str='{"red":"1"}';
var obj = JSON.parse(str);// transform to obj
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse
I know it's bad syntax. It was an example of what I want to do, but I don't know the syntax of how to do it. As I said, I tried to do it the way DataManager does it, and that only gave me a string, not an object with keys/values.

I'll play around with that suggestion tonight. Thanks 🙂
I'm just totally guessing here but I'm assuming that the Note tag meta data just takes the left side of the colon as the property and the right side as the value. I could be wrong.

What I know works is using struct type plugin parameters and making one of the properties the Actor, Class, Weapon, Item etc that you want to attach the rest to. That's what I tend to do in most cases.
If you have

<foo>

as a note tag, then object.meta.foo will be true. If you don't have it as a note tag, then object.meta.foo will be false.

If you have

<foo:bar>

as a note tag, then object.meta.foo will be "bar".

What I want to achieve is this:
object.meta.colour.yellow
object.meta.colour.blue
object.meta.colour.red

I want my meta tags to go down an extra level.

But I can't have <colour:yellow> and <colour:blue> and <colour:red> because each new one will just replace the previous one. And the yellow/blue/red are variable - they could be any text and I won't know what text is going to be used (that will be up to whoever uses the plugin).

To make a struct type note similar to that used by parameters, I would also have to add the logic of how a string will be converted, so it's not much different to the suggestion to use JSON.parse(...).


Edit:
you can use parse

That worked perfectly! Thank you 🙂

Original thread: https://forums.rpgmakerweb.com/threads/how-to-put-a-hash-object-array-into-notes.90357/