-1

I have an object which contain multiple arrays like in the following screenshot:

Object Screenshot

and I would like to convert it into this object:

{ "Manifacture": "Samsung", "Model": "Ipad 2" }

in order to use the data in bootstrap table.

When using stringify, I'm getting the following:

"{"Manifacture":[{"id":2,"name":"Samsung"}],"Model":[{"id":1,"name":"Ipad 2"}]"}"

which is different than what I need.

Is it possible?

CodeMouse92
  • 6,840
  • 14
  • 73
  • 130
ctrllior
  • 3
  • 4

1 Answers1

1

You could just process the object using plain javascript.

for (var key in obj) {
    obj[key] = obj[key][0].name
}

JSON.stringify(obj)