28 Unix tools. One binary. Zero dependencies.·the missing coreutils for the agent era·try vrk in your browser at vrk.sh/play·curl vrk.sh/install.sh | sh - ready in 5 seconds·

vrk recase

Try it in your browser

vrk, compiled to WebAssembly

# Converts snake_case to camelCase.

Enter runs, Shift+Enter adds a line
    output
    Press RUN. Nothing leaves your browser.

    files you can cat:

    Edit the command and press RUN. Open the full playground for more recipes, or install vrk to run it on your own files.

    vrk recase converts text between naming conventions such as snake_case, camelCase, kebab-case, and PascalCase.

    The problem

    Converting 200 field names from snake_case to camelCase takes 30 lines of Python to handle edge cases: leading underscores, consecutive capitals, numeric suffixes. sed 's/_\(.\)/\U\1/g' handles simple cases but breaks on acronyms like http_api_url.

    The solution

    vrk recase converts between naming conventions: snake_case, camelCase, PascalCase, kebab-case, SCREAMING_SNAKE, Title Case, and more. It detects the input convention and handles acronyms. It converts line by line, so you can convert a batch.

    Before and after

    Before

    echo 'user_first_name' | sed 's/_\(.\)/\U\1/g'
    # Breaks on acronyms, doesn't handle PascalCase or kebab-case
    

    After

    echo 'user_first_name' | vrk recase --to camel
    

    Example

    echo 'user_first_name' | vrk recase --to camel
    

    Exit codes

    CodeMeaning
    0Success
    1Runtime error (I/O failure)
    2–to missing or invalid value, interactive TTY with no stdin

    Flags

    FlagShortTypeDescription
    --tostringTarget convention: camel, pascal, snake, kebab, screaming, title, lower, upper
    --json-jboolEmit JSON per line: {input, output, from, to}
    --quiet-qboolSuppress stderr output

    Supported conventions

    vrk recase converts identifiers between naming conventions such as camelCase, snake_case and kebab-case.

    ConventionExampleFlag value
    camelCasehelloWorldcamel
    PascalCaseHelloWorldpascal
    snake_casehello_worldsnake
    kebab-casehello-worldkebab
    SCREAMING_SNAKEHELLO_WORLDscreaming
    Title CaseHello Worldtitle
    lowercasehello worldlower
    UPPERCASEHELLO WORLDupper

    recase detects the input convention itself. You only set the target with --to.

    How it works

    $ echo 'hello_world' | vrk recase --to camel
    helloWorld
    
    $ echo 'helloWorld' | vrk recase --to snake
    hello_world
    
    $ echo 'user_first_name' | vrk recase --to pascal
    UserFirstName
    
    $ echo 'UserFirstName' | vrk recase --to kebab
    user-first-name
    

    Batch conversion

    recase converts each line on its own, so you can convert many names at once:

    $ printf 'user_first_name\nuser_last_name\nemail_address\n' | vrk recase --to camel
    userFirstName
    userLastName
    emailAddress
    

    JSON output

    $ echo 'hello_world' | vrk recase --to camel --json
    {"from":"snake","input":"hello_world","output":"helloWorld","to":"camel"}
    

    Pipeline integration

    Convert API field names

    # Extract keys from a JSON object and convert to camelCase
    echo '{"user_name":"alice","email_addr":"[email protected]"}' | \
      jq -r 'keys[]' | vrk recase --to camel
    

    Rename files in a directory

    # Convert kebab-case filenames to snake_case
    for f in *.md; do
      NEWNAME=$(echo "${f%.md}" | vrk recase --to snake).md
      mv "$f" "$NEWNAME"
    done
    

    When it fails

    If you leave out --to, recase exits 2:

    $ echo 'hello' | vrk recase
    usage error: --to is required
    $ echo $?
    2
    

    If the convention is unknown, recase exits 2:

    $ echo 'hello' | vrk recase --to unknown
    usage error: recase: unknown convention: "unknown"; valid: camel, pascal, snake, kebab, screaming, title, lower, upper
    $ echo $?
    2