function getChildPaths (json, includeObjects) {
  const pathsMap = {}

  function getObjectChildPaths (json, pathsMap, rootPath, includeObjects) {
    const isValue = !Array.isArray(json) && !isObject(json)

    if (isValue || includeObjects) {
      pathsMap[rootPath || ''] = true
    }

    if (isObject(json)) {
      Object.keys(json).forEach(field => {
        getObjectChildPaths(json[field], pathsMap, rootPath + '.' + field, includeObjects)
      })
    }
  }

  if (Array.isArray(json)) {
    const max = Math.min(json.length, MAX_ITEMS_FIELDS_COLLECTION)
    for (let i = 0; i < max; i++) {
      const item = json[i]
      getObjectChildPaths(item, pathsMap, '', includeObjects)
    }
  } else {
    pathsMap[''] = true
  }

  return Object.keys(pathsMap).sort()
}
Get the child paths of an array
@param {JSON} json
@param {boolean} [includeObjects=false] If true, object and array paths are returned as well
@return {string[]}