Functionality works, but has weird bug in displaying json