more json encoding and search implementation