Double in an object converts to a string (or just goes into quotation marks) when added in another object. I don't want this behavior. I want the double to remain as double so that my database rules work perfectly
var list: [String: AnyObject] = [:]
var obj: [String: Any] = [:]
obj["pi"] = 3.14
obj["test"] = "hello"
list["firstObj"] = obj as AnyObject
print(list)
This is the result:
["firstObj": { pi = "3.14"; test = hello; }]
I want this
["firstObj": { pi = 3.14; test = hello; }]
Please suggest what can I do to achieve the desired result
Note: You can run this code in playground to check.
Edited
The question is still unresolved. After following the answers I made the model and posted it to my firebase. Now this is the exception I get in return
'InvalidFirebaseData', reason: '(setValue:withCompletionBlock:) Cannot store object of type _SwiftValue at cardCost. Can only store objects of type NSNumber, NSString, NSDictionary, and NSArray.'
I want to make it firebase readable