Skip to content

fix: cast state population to integer in JSON exporter#1321

Merged
dr5hn merged 1 commit into
dr5hn:masterfrom
swkim0911:fix/exporter-states-population-int
Dec 13, 2025
Merged

fix: cast state population to integer in JSON exporter#1321
dr5hn merged 1 commit into
dr5hn:masterfrom
swkim0911:fix/exporter-states-population-int

Conversation

@swkim0911
Copy link
Copy Markdown
Contributor

Description

The documentation specifies that the population field should be exported as an integer.
However, in the generated JSON (and MongoDB dump), the states dataset was outputting population as a string due to a missing type cast in the exporter.

This PR updates the exporter to ensure that the population field in the states dataset is cast to an integer, aligning the output with the documented schema and improving data consistency.

What I have done

Added integer casting for the population field in the JSON exporter.

$statesArray[$i]['population'] = $state['population'];

to

$statesArray[$i]['population'] = $state['population'] !== null ? (int)$state['population'] : null;

Behavior now matches the existing implementation for countries and cities.
Ensures that future JSON exports output the correct integer type.

Notes

This change does not affect any other fields or datasets.

Fixs #1320

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. fixed Issue has been fixed labels Dec 12, 2025
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Dec 13, 2025
@dr5hn dr5hn merged commit 95b8a8e into dr5hn:master Dec 13, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fixed Issue has been fixed lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Population field stored as string type, but documentation says integer

2 participants