Modifying constructJson for Pattern Matching