Utiliza el método parse
, para convertir la cadena de texto en un arreglo JS
.
var colors = JSON.parse("stringEnJson");
console.log(colors[0]);
Mira este snippet:
const array = '[{"id":1,"name":"Light Black","code":"#282525","color_palette_id":1,"created_at":"2019-08-25 17:29:06","updated_at":"2019-08-25 17:29:06","deleted_at":null}]';
var colors = JSON.parse(array);
console.log(colors[0]);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>