edit with proper json parsing