Added support for JSON api.