{"action":"created","issue":{"url":"https://api.github.com/repos/ThemeFuse/Unyson/issues/366","labels_url":"https://api.github.com/repos/ThemeFuse/Unyson/issues/366/labels{/name}","comments_url":"https://api.github.com/repos/ThemeFuse/Unyson/issues/366/comments","events_url":"https://api.github.com/repos/ThemeFuse/Unyson/issues/366/events","html_url":"https://github.com/ThemeFuse/Unyson/issues/366","id":62109713,"number":366,"title":"[question] How to convert Unyson options json to option names in JS?","user":{"login":"danyj","id":2340172,"avatar_url":"https://avatars.githubusercontent.com/u/2340172?v=3","gravatar_id":"","url":"https://api.github.com/users/danyj","html_url":"https://github.com/danyj","followers_url":"https://api.github.com/users/danyj/followers","following_url":"https://api.github.com/users/danyj/following{/other_user}","gists_url":"https://api.github.com/users/danyj/gists{/gist_id}","starred_url":"https://api.github.com/users/danyj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danyj/subscriptions","organizations_url":"https://api.github.com/users/danyj/orgs","repos_url":"https://api.github.com/users/danyj/repos","events_url":"https://api.github.com/users/danyj/events{/privacy}","received_events_url":"https://api.github.com/users/danyj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-03-16T15:09:08Z","updated_at":"2015-03-16T18:48:00Z","closed_at":null,"body":"I was wondering if Unyson has a way to convert  the \r\n\r\n    fw_get_db_settings_option()\r\n\r\nto an array of option names in JS? like \r\n\r\n    name=\"fw_options[option][gadget][custom]\r\n\r\nor ad-least the\r\n\r\n    [option][gadget][custom]\r\n\r\nI started the convert but the json data from ajax request are deep so extracting the exact name is bit of trouble. First levels are oki'sh but further than that is troublesome. \r\n\r\n\t\t\t$.ajax({\r\n\t\t\t  type : 'get',\r\n\t\t\t  dataType : 'json',\r\n\t\t\t  url: ajaxurl,\r\n\t\t\t  data: {\r\n\t\t\t\t'action': 'thz_get_default_options',  \r\n\t\t\t  }\r\n\t\t\t  \r\n\t\t\t  }).done(function(data){\r\n\t\t\t\t  \r\n\t\t\t\t  console.log(data.options);  \r\n\t\t\t\t  for(var x in data.options) {\r\n\t\t\t\t\t  for(var y in data.options[x]) {\r\n\t\t\t\t\t\tconsole.log( \"name of \"+x+\" is: \"+data.options[x][y] );\r\n\t\t\t\t\t  }\r\n\t\t\t\t  }\r\n\r\n\t\t\t\t  \r\n\t\t\t  }).fail(function(jqXHR, textStatus, errorThrown){ \r\n\t\t\t  \t\tconsole.error(jqXHR, textStatus, errorThrown);\r\n\t\t\t  });\r\n\r\n\r\nphp\r\n\r\n\r\nfunction thz_get_default_options() {\r\n\t\r\n\t$options = fw_get_db_settings_option();\r\n\r\n\r\n\t$return = array(\r\n\t\t'options'\t=> $options,\r\n\t);\t\r\n\twp_send_json($return);\r\n}\r\n\r\nadd_action(\"wp_ajax_thz_get_default_options\", \"thz_get_default_options\");\r\n"},"comment":{"url":"https://api.github.com/repos/ThemeFuse/Unyson/issues/comments/81864252","html_url":"https://github.com/ThemeFuse/Unyson/issues/366#issuecomment-81864252","issue_url":"https://api.github.com/repos/ThemeFuse/Unyson/issues/366","id":81864252,"user":{"login":"moldcraft","id":1475489,"avatar_url":"https://avatars.githubusercontent.com/u/1475489?v=3","gravatar_id":"","url":"https://api.github.com/users/moldcraft","html_url":"https://github.com/moldcraft","followers_url":"https://api.github.com/users/moldcraft/followers","following_url":"https://api.github.com/users/moldcraft/following{/other_user}","gists_url":"https://api.github.com/users/moldcraft/gists{/gist_id}","starred_url":"https://api.github.com/users/moldcraft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moldcraft/subscriptions","organizations_url":"https://api.github.com/users/moldcraft/orgs","repos_url":"https://api.github.com/users/moldcraft/repos","events_url":"https://api.github.com/users/moldcraft/events{/privacy}","received_events_url":"https://api.github.com/users/moldcraft/received_events","type":"User","site_admin":false},"created_at":"2015-03-16T18:48:00Z","updated_at":"2015-03-16T18:48:00Z","body":"(There was a little mistake in the function, I edited the comment)"}}