JSFiddle - React, Tailwind, and code Playground

JavaScript

$(function () {
    a = {};
    a.prop1 = "hello";
    a.prop2 = "there";
    
    a.toJSON = function () {
        copy = {};
        copy.prop2 = this.prop2;
        copy.prop1 = this.prop1;
        return copy;
    };
    
    alert(JSON.stringify(a));
});