Serialize All DataTable Data (All Rows) to a JSON String
Serialize All DataTable Data (All Rows) to a JSON String

I need to stringify the entire DataTable into a JSON string.
But this gives an error:
var allDataStr = JSON.stringify($('#advanced_search_results').DataTable().rows().data());
I thought, first I can do $('#..').DataTable().rows().data()
for the full JSON object, then JSON.stringify.
The error is:
Uncaught TypeError: Converting circular structure to JSON
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You might need to chain
toArray()
, something like this:JSON.stringify($('#advanced_search_results').DataTable().rows().data().toArray());
Kevin