How do I check for an empty JSON object in Javascript? I thought the key was
var isEmpty = (response || []).length === 0;
but this isn't it. In my JS console, I have tried
jsonresp = {}
{}
jsonresp.length
undefined
What's driving this is I have a Ruby on Rails controller that is returning the following
render json: job_id.eql?(cur_job_id) ? {} : json_obj
In the case where the controller returns the "{}" is where I'm having trouble on the JS side recognizing if it is empty or not.