All Tools View Categories About Contact Privacy

Extract Numbers from YAML

undefined

Runs in your browser. The YAML text is processed locally and is not sent to an external service.

About Extract Numbers from YAML

Numeric configuration values often represent ports, timeouts, retry counts, limits, versions encoded numerically, weights, thresholds, or resource quantities. This tool extracts those values from a YAML document and returns one finite number per line. It relies on the parsed YAML type, so an actual numeric scalar is included while a quoted value such as "8080" is treated as a string and excluded. That distinction is important because configuration formats sometimes quote numbers deliberately when the consumer expects text.

The output can be useful for audits and testing. A large deployment configuration may contain many numbers scattered across nested sections. Extracting them gives a compact list for quick inspection. You can look for surprising ports, unusually large retry limits, tiny timeouts, or values that should fall within a policy range. The tool does not attach field paths to each number, so it is best for inventory and inspection rather than precise remediation. Pair it with the YAML source when you need to locate a questionable value.

The extractor walks arrays as well as mappings. If a configuration lists replica counts or numeric thresholds inside a sequence, those values are returned too. Duplicate numbers are preserved because they represent separate occurrences. Negative values and finite decimal values are included when the parser recognizes them as numbers. Special non-finite forms are not emitted because the result is intended to be a straightforward numeric text list rather than a representation of JavaScript-specific edge cases.

A useful learning exercise is to compare numeric and string representations. Write one field as port: 8080 and another as port_text: "8080", then extract numbers. Only the first appears. That difference illustrates a core YAML concept: the syntax is not just decoration; it determines the data type consumed by downstream applications. Understanding when a number is truly numeric can prevent subtle bugs in configuration systems that distinguish a count from a string token.

The tool validates the YAML before extraction. This is important because an incomplete indentation block could otherwise produce a misleading numeric list. Once parsed, the browser traverses the resulting tree without any network call. The result can be copied into a test case, spreadsheet, shell input, or manual review. For sensitive configuration, the local execution model is also useful: the source remains in the browser session instead of being sent to an external parsing service.

Use the output as a candidate list for policy checks, not as a final compliance report. A port might be valid only in one section, a timeout might use seconds in one application and milliseconds in another, and a number may have a special sentinel meaning. The extractor makes the numeric inventory easy to obtain; domain rules still determine whether a value is acceptable.

For regression testing, store the numeric list beside a known configuration revision and compare it after generator changes. Unexpected additions or removals can then trigger a review. Because occurrences are preserved, the result can also reveal whether the same limit is repeated across several services or environments.

Numbers often need unit context, so resist the temptation to compare them blindly. A value of 30 could mean seconds, retries, megabytes, or a policy level depending on the field. The extractor intentionally does not guess units. Its role is to collect the numeric candidates; your schema, documentation, or application rules should provide the meaning. This separation makes the result reusable across different YAML domains.

Features

  • Feature 1: Extract integer and floating-point values.
  • Feature 2: Walk nested mappings and arrays.
  • Feature 3: Ignore strings and booleans.
  • Feature 4: Return one number per line.
  • Feature 5: Preserve the parsed numeric text representation.
  • Feature 6: Validate the YAML first.
  • Feature 7: Copy the numeric list.
  • Feature 8: Download the results locally.

How to Use

  1. Paste or type the YAML source in the editor.
  2. Use Load Sample to see a representative input.
  3. Click Extract Numbers to process the document and review the result.
  4. Check the statistics beneath the output for a quick sanity check.
  5. Use Copy for the clipboard or Download for a local file.
  6. Keep the original YAML when exact comments and formatting need to be preserved.

Examples

  • Port: 8080 is extracted.
  • Decimal: 30.5 appears as one numeric value.
  • Negative: -5 is included when parsed as a number.
  • Quoted number: "8080" is excluded because it is a string.
  • Array numbers: numeric list entries are included.

Benefits

  • Practical: Inventory ports and limits.
  • Reviewable: Prepare numeric datasets.
  • Local: Audit thresholds and counts.
  • Reusable: Inspect generated environment values.
  • Maintainable: Find unexpectedly large or small values.
  • Fast: Create simple input lists for testing.

Frequently Asked Questions

Are quoted numbers included?
No. A quoted number is a string and is intentionally excluded.
Are decimal values included?
Yes, finite floating-point values are included.
Are negative numbers included?
Yes, when the YAML parser reads them as numbers.
Are booleans included?
No. true and false are separate YAML types.
Are array numbers included?
Yes, recursively.
Can duplicate numbers appear?
Yes. Every occurrence is preserved.
What happens on invalid YAML?
The extraction stops with an error.
Can I download the numbers?
Yes, as a plain text list.