为查询参数执行 RESTish 对象数组的最佳方法

问题描述

我正在为旧唱片构建音乐编目服务,并且我有一些高级查询以允许用户搜索特定字段。我最初的想法是这样做:

df[df == "_"] = NA
df = as.data.frame(sapply(df,function(x) gsub(",","",x)))
i <- apply(df,2,function(x) !any(is.na(as.numeric(na.omit(x))))) # if a column can be converted to numeric without any NAs,e.g. column 1 can't
df[,i] = lapply(df[,i],as.numeric)

问题在于它编码为这种格式:

api/catalog?search=string&filter=[{field1:value1},{field2:value1},...]

对于如何传入对象数组似乎没有普遍的共识。

最好将查询参数字符串化以便在后端反序列化?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)