var toJsonSchema = require("to-json-schema")
const data = {"temperature":"+24 °C","wind":"11 km/h","description":"Sunny","forecast":[{"day":"1","temperature":"21 °C","wind":"7 km/h"},{"day":"2","temperature":"7 °C","wind":"6 km/h"},{"day":"3","temperature":"10 °C","wind":" km/h"}]}
const options = {
postProcessFnc: (type, schema, obj, defaultFnc) => ({
...defaultFnc(type, schema, obj),
type: [type, 'null'],
}),
objects: {
postProcessFnc: (schema, obj, defaultFnc) => ({
...defaultFnc(schema, obj),
required: Object.getOwnPropertyNames(obj),
}),
}
}
console.log(toJsonSchema(data, options))