JSFiddle - React, Tailwind, and code Playground
HTML
<form action="">
<input type="text" name="test1">
<input type="text" name="test2">
<input type="text" name="test3">
</form>
<div></div>
<button>toJson</button>
JavaScript
$("div").text(JSON.stringify($("form").serializeArray()));
$("button").click(function() {
$("div").text(JSON.stringify($("form").serializeArray()));
})