well formed json function