rewrite to use JObject instead of Dictionary