这是indexloc提供的服务,不要输入任何密码
Skip to content

Double on Linux #22

@klevison

Description

@klevison

Alembic doesn't cast Int value to Double on Linux (MacOS its ok).

JSONString:
{"op":"mcm","id":2,"clk":"AKUBANQBAN0B","pt":1505853621577,"mc":[{"id":"1.133562061","rc":[{"bdatb":[[0,3,214.98]],"id":1221386},{"bdatl":[[0,1.49,68.46]],"id":1221385}]}]}

Error:
typeMismatch(expected: Double, actualValue: 3, path: Path([1]))

Code:

struct BDAT: Parsable {

    var level: Int
    var price: Double
    var size: Double
    
    static func value(from json: JSON) throws -> BDAT {
        return try .init(
            level: json.value(for: [0]),
            price: json.parse(Double.self, for: [1])
            size: json.value(for: [2])
        )
    }
    
}

I've already tried: json.parse(Double.self, for: [1]) and json.parse(for: [1])

SO: Ubuntu 16.04
Swift: 3.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions