You can use Prometheus JSON Exporter (https://github.com/prometheus-community/json_exporter) to call your service and extract values from JSON
Deploy Prometheus JSON Exporter where it can be pulled by Prometheus and where Exporter can hit your URL
For your JSON example config.xml for JSON Exporter will be like
---
metrics:
- name: user_count
path: "{$.data.UserCount}"
type: value
help: UserCount value
- name: user_count_active
path: "{$.data.UserCountActive}"
type: value
help: UserCountActive value
and scrape config in Prometheus (prometheus.yml):
## gather the metrics from third party json sources, via the json exporter
- job_name: json_user_stat
metrics_path: /probe
static_configs:
- targets:
# URL of each API for json exporter
- https://example.com/api/stats
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
# Location of the json exporter's real <hostname>:<port> from Prometheus
replacement: json_exporter:7979
Test first your Exporter by hitting URL (please encode "target" value if you like to use outside of your browser, browser will encode automatically) http://json_exporter:7979/probe?target=https://example.com/api/stats and check output
# HELP UserCount value
# TYPE logstash_audit_events_in untyped
user_count{} 140
# HELP lUserCountActive value
# TYPE logstash_audit_events_out untyped
user_count_active{} 23
If you get it - configure scape in Prometheus and enjoy your metrics