JSFiddle - React, Tailwind, and code Playground

HTML

<script>
$(function(){
	function getObject(){
		if (navigator.geolocation)
		{
			navigator.geolocation.getCurrentPosition(function(position) {
    console.log(position);
    
    console.log(jQuery.stringify(position));
			}, function(error)
			{
				alert("Error occurred. Error code: " + error.code);
			});
		}
	}
	$('#getObj').on('click',function(){
		getObject();
	});
});
</script>
<div>
	<a data-role="button" id="getObj">Get Position Object</a>
</div>

JavaScript

jQuery.extend({
	stringify : function stringify(obj) {
		
		var t = typeof (obj);
		if (t != "object" || obj === null) {
			// simple data type
			if (t == "string") 
				obj = '"' + obj + '"';
			return String(obj);
		} else {
			// recurse array or object
			var n, v, json = [], arr = (obj && obj.constructor == Array);
			for (n in obj) {
				v = obj[n];
				t = typeof(v);
				if (obj.hasOwnProperty(n)) {
					if (t == "string") 
						v = '"' + v + '"';
					else if (t == "object" && v !== null)
						v = jQuery.stringify(v);
					json.push((arr ? "" : '"' + n + '":') + String(v));
				}
			}
			return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}");
		}
	}
});