Learn R Programming

ip2location.io (version 0.0.0-2)

safe_extract: Safe Data Extraction from API Response

Description

This function extracts the value of a given field from the parsed API response. It handles missing or empty data gracefully by returning NA if the field is missing.

Usage

safe_extract(x, field)

Value

The extracted field value, or NA if missing or empty.

Arguments

x

The parsed JSON response (usually a list).

field

The name of the field to extract (as a string).