First of all you don't need to maintain datatypes in the JSON enum to parse your response.
The JSONDecoder will be able to parse with the appropriate datatype if you match your object to the response structure that you receive from APIs or JSON files maintained locally
Taking you json file as example:
{"name": "fff", "price": 10}
The recommended way to parse this structure would be as follows
Create a struct or class according to your needs. For this I will use a struct
struct Product: Decodable {
var name: String?
var price: Int?
}
I have marked both the vars optionals just in case to handle the failures if the field does not exist in the JSON response.
Parse the Structure
Use the product struct that was created in the previous step by creating a decoder instance and setting the Product.Self to parse the object
let decoder = JSONDecoder()
let productObject = try decoder.decode(Product.self, from: jsonData)
If you have an array of objects of the same structure in the JSON response use below:
let productObjects = try decoder.decode([Product].self, from: jsonData)
Just include [] around the product object