0

I use jquery tokeninput. A flatted json is no problem to be searched. but howto input nested object.

my code:

   var flat_obj = [{id: 7, name: "Ruby"}, {id: 11, name: "Python"}];
   var nested_obj = [{ "name": "main", "id": "2", "Parent": "0", "children": [{ "name": "submain", "id": "3", "Parent": "2"}] }];

   $("#search-input-local").tokenInput(nested_obj, { });
hahamed
  • 309
  • 1
  • 2
  • 12

1 Answers1

1

TokenInput doesn't handle nested JSON, you will need to format the JSON correctly before you pass it to the plugin.

There are a number of libraries to flatten JSON, or take a look at this question here.

Community
  • 1
  • 1
Chris
  • 5,882
  • 2
  • 32
  • 57