Convert Properties to YAML

Drag and drop files here or click to select.
Max file size 100mb.
Uploading progress:

Properties vs YAML Format Comparison

Aspect Properties (Source Format) YAML (Target Format)
Format Overview
Properties
Java Properties File

Simple key=value text format from the Java ecosystem. Each line stores a property name and value separated by = or :. The default configuration format for Java applications, Spring Boot (application.properties), Apache projects, and many JVM-based frameworks.

Key=Value Pairs Java Ecosystem
YAML
YAML Ain't Markup Language

Human-friendly data serialization language using indentation for hierarchy. YAML supports mappings, sequences, scalars, and complex types with minimal syntax. It is the preferred format for Kubernetes manifests, Docker Compose, Ansible playbooks, GitHub Actions, and Spring Boot's application.yml.

Indentation-Based DevOps Standard
Technical Specifications
Structure: Flat key=value lines
Encoding: ISO-8859-1 (Latin-1) / UTF-8
Format: java.util.Properties specification
Comments: # or ! prefix
Extensions: .properties
Structure: Indentation-based hierarchy
Encoding: UTF-8
Format: YAML 1.2 specification
Comments: # prefix
Extensions: .yaml, .yml
Syntax Examples

Spring Boot properties with dotted keys:

# Application config
spring.application.name=OrderService
server.port=8080
server.ssl.enabled=true
spring.datasource.url=jdbc:mysql://db:3306/orders
spring.datasource.username=app_user
spring.datasource.pool.max-active=25

YAML with indented hierarchy:

# Application config
spring:
  application:
    name: OrderService
  datasource:
    url: jdbc:mysql://db:3306/orders
    username: app_user
    pool:
      max-active: 25
server:
  port: 8080
  ssl:
    enabled: true
Content Support
  • Key=value and key:value separators
  • Line continuation with backslash
  • Unicode escapes (\uXXXX)
  • Comment lines (# and !)
  • All values stored as strings
  • Dotted key naming convention
  • No hierarchy or nesting
  • Mappings (key: value pairs)
  • Sequences (arrays/lists)
  • Scalars with type inference
  • Multi-line strings (| and >)
  • Anchors and aliases (& and *)
  • Multi-document support (---)
  • Inline/flow style for compact data
  • Merge keys for inheritance
Advantages
  • Extremely simple and familiar
  • Native Java API support
  • Minimal learning curve
  • Widely supported in JVM ecosystem
  • Easy to parse and generate
  • Spring Boot default configuration
  • Clean, readable indentation-based structure
  • Native Spring Boot support (application.yml)
  • Multi-profile documents (--- separator)
  • Native list and map support
  • Type inference (int, bool, float, null)
  • DevOps ecosystem standard
  • Less repetition than Properties
Disadvantages
  • All values are strings (no type safety)
  • No native hierarchy or nesting
  • No support for arrays or lists
  • Flat structure becomes unwieldy at scale
  • ISO-8859-1 default encoding limitation
  • Indentation errors cause parse failures
  • Tab characters are not allowed
  • Implicit typing can cause surprises
  • Complex nesting becomes hard to track
  • Multiple valid representations for same data
Common Uses
  • Java/Spring Boot configuration
  • Apache project settings
  • Internationalization (i18n) bundles
  • Build tool configuration
  • Application server settings
  • Kubernetes manifests and Helm charts
  • Docker Compose files
  • Spring Boot application.yml
  • Ansible playbooks and inventories
  • GitHub Actions workflows
  • CI/CD pipeline definitions
Best For
  • JVM-based application settings
  • Simple flat key-value storage
  • Legacy Java application support
  • Resource bundles and localization
  • Modern Spring Boot configuration
  • Cloud-native and Kubernetes deployments
  • DevOps automation and CI/CD
  • Multi-profile application settings
Version History
Introduced: Java 1.0 (1996)
Current Version: Part of java.util since JDK 1.0
Status: Stable, widely used
Evolution: UTF-8 support added in Java 9
Introduced: 2001 (Clark Evans, Ingy, Oren)
Current Version: YAML 1.2.2 (2021)
Status: Stable specification
Evolution: JSON became valid YAML subset in 1.2
Software Support
Java: java.util.Properties (built-in)
Spring: application.properties native support
IDEs: IntelliJ, Eclipse, VS Code
Other: Apache Commons Configuration
Java: SnakeYAML, Jackson YAML
Python: PyYAML, ruamel.yaml
Spring: application.yml native support
Tools: kubectl, docker-compose, ansible

Why Convert Properties to YAML?

Converting application.properties to application.yml is one of the most common configuration migrations in the Spring Boot ecosystem. YAML's indentation-based hierarchy eliminates the repetitive dotted prefixes that make large Properties files difficult to read. Instead of repeating spring.datasource. on every line, YAML groups related settings under a single datasource: key with indented children.

YAML's multi-document support enables Spring Boot profile-specific configuration in a single file. Using the --- separator and spring.config.activate.on-profile, you can define development, staging, and production configurations within one application.yml file. This is impossible with Properties files, which require separate files per profile (application-dev.properties, application-prod.properties).

The DevOps ecosystem has standardized on YAML for infrastructure configuration. Kubernetes manifests, Docker Compose files, GitHub Actions workflows, Ansible playbooks, and Helm charts all use YAML. Converting your application Properties to YAML aligns your configuration format with the rest of your deployment stack, creating a consistent experience for developers and operators.

YAML's native type support provides implicit validation. While Properties files treat server.port=8080 as a string that must be parsed at runtime, YAML recognizes port: 8080 as an integer, enabled: true as a boolean, and timeout: 30.5 as a float. This type awareness catches configuration errors earlier and reduces boilerplate type-conversion code in your application.

Key Benefits of Converting Properties to YAML:

  • Reduced Repetition: Hierarchical structure eliminates repeated dotted key prefixes
  • Multi-Profile Support: Single file with --- separators for different environments
  • Native Type Inference: Integers, booleans, floats, and null recognized automatically
  • List Support: Native YAML sequences replace comma-separated string values
  • DevOps Alignment: Consistent format with Kubernetes, Docker, and CI/CD tools
  • Spring Boot Native: application.yml is a first-class Spring Boot configuration format
  • Better Readability: Clean indentation shows configuration structure at a glance

Practical Examples

Example 1: Complete Spring Boot Configuration

Input Properties file (application.properties):

spring.application.name=UserService
server.port=8080
server.servlet.context-path=/api/v1

spring.datasource.url=jdbc:postgresql://db:5432/users
spring.datasource.username=user_svc
spring.datasource.hikari.maximum-pool-size=20
spring.datasource.hikari.minimum-idle=5

spring.jpa.hibernate.ddl-auto=validate
spring.jpa.show-sql=false
spring.jpa.properties.hibernate.format_sql=true

management.endpoints.web.exposure.include=health,info,metrics
management.endpoint.health.show-details=always

Output YAML file (application.yml):

spring:
  application:
    name: UserService
  datasource:
    url: jdbc:postgresql://db:5432/users
    username: user_svc
    hikari:
      maximum-pool-size: 20
      minimum-idle: 5
  jpa:
    hibernate:
      ddl-auto: validate
    show-sql: false
    properties:
      hibernate:
        format_sql: true

server:
  port: 8080
  servlet:
    context-path: /api/v1

management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics
  endpoint:
    health:
      show-details: always

Example 2: Multi-Profile Configuration

Input Properties files (separate files):

# application.properties (shared)
app.name=PaymentGateway
app.version=2.1.0
logging.level.root=INFO

# application-dev.properties
server.port=8080
spring.datasource.url=jdbc:h2:mem:testdb
app.debug=true

# application-prod.properties
server.port=8443
spring.datasource.url=jdbc:postgresql://db-prod:5432/payments
app.debug=false

Output YAML file (application.yml) - single file:

app:
  name: PaymentGateway
  version: 2.1.0

logging:
  level:
    root: INFO

---
spring:
  config:
    activate:
      on-profile: dev
  datasource:
    url: jdbc:h2:mem:testdb

server:
  port: 8080

app:
  debug: true

---
spring:
  config:
    activate:
      on-profile: prod
  datasource:
    url: jdbc:postgresql://db-prod:5432/payments

server:
  port: 8443

app:
  debug: false

Example 3: Security and OAuth2 Settings

Input Properties file (security.properties):

spring.security.oauth2.client.registration.google.client-id=abc123
spring.security.oauth2.client.registration.google.client-secret=xyz789
spring.security.oauth2.client.registration.google.scope=openid,profile,email
spring.security.oauth2.client.provider.google.authorization-uri=https://accounts.google.com/o/oauth2/auth
spring.security.oauth2.client.provider.google.token-uri=https://oauth2.googleapis.com/token
app.security.cors.allowed-origins=http://localhost:3000,https://myapp.com
app.security.jwt.expiration=86400

Output YAML file (security.yml):

spring:
  security:
    oauth2:
      client:
        registration:
          google:
            client-id: abc123
            client-secret: xyz789
            scope:
              - openid
              - profile
              - email
        provider:
          google:
            authorization-uri: https://accounts.google.com/o/oauth2/auth
            token-uri: https://oauth2.googleapis.com/token

app:
  security:
    cors:
      allowed-origins:
        - http://localhost:3000
        - https://myapp.com
    jwt:
      expiration: 86400

Frequently Asked Questions (FAQ)

Q: Can I use application.yml instead of application.properties in Spring Boot?

A: Yes, Spring Boot natively supports both formats. You can replace application.properties with application.yml and the application will work identically. Spring Boot loads YAML files using the SnakeYAML library, which is included automatically. Both formats can coexist, with Properties taking precedence.

Q: How are dotted property keys converted to YAML hierarchy?

A: Each dot in a property key creates a new indentation level in YAML. For example, spring.datasource.url=... becomes three levels: spring: at the root, datasource: indented one level, and url: indented two levels. This grouping eliminates the repetitive prefixes found in Properties files.

Q: How are comma-separated values handled?

A: Comma-separated values in Properties files (e.g., app.cors.origins=host1,host2) can be converted to YAML sequences (arrays) with each value on its own line prefixed by -. This provides proper list semantics instead of requiring string splitting in application code.

Q: Does YAML support Spring Boot profiles like Properties files do?

A: YAML actually improves on Properties profile support. While Properties require separate files per profile (application-dev.properties), YAML allows multiple profiles in a single file separated by --- with spring.config.activate.on-profile. This keeps all configuration visible in one place.

Q: Are boolean and numeric values preserved as types in YAML?

A: Yes. Properties treats all values as strings, but YAML recognizes types: true/false become booleans, numeric values become integers or floats, and null/~ becomes null. String values that could be misinterpreted (like "yes", "no", "on", "off") are quoted to prevent unintended type conversion.

Q: Can YAML handle Properties files with special characters in values?

A: Yes. Values containing YAML-sensitive characters (colons, brackets, braces, quotes) are automatically wrapped in quotes. Unicode characters from Properties escape sequences (\uXXXX) are converted to their actual UTF-8 characters in the YAML output.

Q: What happens to comments during conversion?

A: Both Properties and YAML use # for comments, so comment lines are preserved naturally. Comments are placed above their associated configuration section in the YAML output. The ! comment prefix (Properties-only) is converted to # syntax.

Q: Is there a size limit for the conversion?

A: No practical limit. The converter handles Properties files of any size efficiently. YAML output is typically 20-40% shorter than the equivalent Properties file due to eliminated key prefix repetition. Even large enterprise configurations with thousands of properties convert quickly.