Rathna Kumar
Rathna Kumar

Reputation: 1

How to use camelize function for CAPITAL case payload/string

Sample Request:

{
    "message": "HELLO world!"
}

DataWeave script:

%dw 2.0
output application/json
import * from dw::core::Strings
---
camelize(payload.message)

Output Received:

"hELLO world!"

Expected Output:

"hello world!"

Upvotes: 0

Views: 645

Answers (1)

Anurag Sharma
Anurag Sharma

Reputation: 932

as per your requirement you need all letters of a given string in lowercase, for that use "lower()" funciton that returns the provided string in lowercase characters as in below code

%dw 2.0
output application/json
---
lower(payload.message)

the output will be as you are expecting.

This is the screen shot for input, dw script and ouput

enter image description here

below are the official Mulesoft documents link

  1. Camelize: https://docs.mulesoft.com/dataweave/2.2/dw-strings-functions-camelize

  2. Lower : https://docs.mulesoft.com/dataweave/2.4/dw-core-functions-lower

Upvotes: 3

Related Questions