无论深度如何,JSON都会进入数组

时间:2018-04-19 18:28:52

标签: json swift

这里的第一个问题,请耐心等待我。 我正在尝试做一个处理http请求的类。 服务器肯定会以JSON回复,所以 - 除了处理请求之外 - 我还希望将JSON数据转换为字典。 截至目前,我有这个,但我觉得它很不方便......

export interface Person {
    ...
}

export interface Client extends Person {
    claimNumber: string;
    policyNumber: string;
    address: string;
    insuranceCompany: Organisation;
}

// In some utilitarian class
public static getClientInfo(client: Client) {
    return client.policyNumber.concat(client.claimNumber);
}

// In your pipe
return items.filter(item => getClientInfo(item).toLocaleLowerCase().includes(term.toLocaleLowerCase()));

我希望这个课程在尽可能多的情况下有用。在某些情况下,服务器将发送4或5d json。

我的问题如下: 我不能将json转换为数组,无论它的深度如何,php风格?

0 个答案:

没有答案
相关问题