import com.alibaba.fastjson.JSON
import com.alibaba.fastjson.serializer.{PascalNameFilter, SerializerFeature}
import com.chiefclouds.project.yuyuan.zhls.api.orderimport.pojo.param.{ExtraConditions, Parameter}
object ZhlsOrderImport {
def main(args: Array[String]): Unit = {
val startData = "2020-10-29 10:00:00"
val endData = "2020-10-29 11:00:00"
val extraConditions = ExtraConditions(Values = Array("10886"))
val param = Parameter(StartDate = startData,
EndDate = endData,
Conditions = Array(extraConditions))
//首字母大写
val paramStr = JSON.toJSONString(param, new PascalNameFilter, SerializerFeature.QuoteFieldNames)
println(paramStr)
}
}
结果
{"Conditions":[{"Code":"mallid","Operator":"equals","Values":["10886"]}],"EndDate":"2020-10-29 11:00:00","StartDate":"2020-10-29 10:00:00"}