cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to add data type

Pretty
New Contributor III

We have Json file as input source which some random data for that values we need to add datatypes.

Sample data:

{
โ€œIdโ€: โ€œ1076โ€,
โ€œjobTitleโ€: โ€œSoftware engineerโ€,
โ€œfirstNameโ€: โ€œDavidโ€,
โ€œlastNameโ€: โ€œvilleyโ€,
โ€œfullNameโ€: โ€œDavidvilleyโ€,
โ€œemail_Nโ€: โ€œDavidvilley@gmail.comโ€,
โ€œtelephoneNumberโ€: โ€œ+1-8474987109โ€
}

Please help me to add the datatypes for above data to validate.

9 REPLIES 9

darshthakkar
Valued Contributor

Hi @Pretty,

You can use โ€œtype converterโ€ snap to add/modify data type, let me know how it goes.

Pretty
New Contributor III

hello @darshthakkar @ljupcho_machkovski

Thanks for your quick response.

Type converter and type inspector snaps are not available in our snaplogic so is there any alternative method or snaps to achieve this?

ljupcho_machko1
New Contributor III

@Pretty , in the given sample data all the values are type String. You can use Type Inspector snap for this.

koryknick
Employee
Employee

@Pretty - I think we need a bit more description of what youโ€™re trying to do here. If you just want to convert $Id to a number, you can use the built-in expression language function parseInt($Id) in a Mapper snap.

As @ljupcho_machkovski pointed out, everything else is a String. JSON only supports a small number of data types: String, Number, Object, Array, or Boolean.