func (o *jsono) Flush() error {
	var err error
	var res []byte

	if o.withSummary {
		jsonObj := struct {
			Resources []oresult `json:"resources"`
			Summary   struct {
				Valid   int `json:"valid"`
				Invalid int `json:"invalid"`
				Errors  int `json:"errors"`
				Skipped int `json:"skipped"`
			} `json:"summary"`
		}{
			Resources: o.results,
			Summary: struct {
				Valid   int `json:"valid"`
				Invalid int `json:"invalid"`
				Errors  int `json:"errors"`
				Skipped int `json:"skipped"`
			}{
				Valid:   o.nValid,
				Invalid: o.nInvalid,
				Errors:  o.nErrors,
				Skipped: o.nSkipped,
			},
		}

		res, err = json.MarshalIndent(jsonObj, "", "  ")
	} else {
		jsonObj := struct {
			Resources []oresult `json:"resources"`
		}{
			Resources: o.results,
		}

		res, err = json.MarshalIndent(jsonObj, "", "  ")
	}

	if err != nil {
		return err
	}

	fmt.Fprintf(o.w, "%s\n", res)

	return nil
}
// Flush outputs the results as JSON
Flush outputs the results as JSON
// Flush outputs the results as JSON
func (o *jsono) Flush() error {
	var err error
	var res []byte
	if o.withSummary {
		jsonObj := struct {
			Resources []oresult `json:"resources"`
			Summary   struct {
				Valid   int `json:"valid"`
				Invalid int `json:"invalid"`
				Errors  int `json:"errors"`
				Skipped int `json:"skipped"`
			} `json:"summary"`
		}{
			Resources: o.results,
			Summary: struct {
				Valid   int `json:"valid"`
				Invalid int `json:"invalid"`
				Errors  int `json:"errors"`
				Skipped int `json:"skipped"`
			}{
				Valid:   o.nValid,
				Invalid: o.nInvalid,
				Errors:  o.nErrors,
				Skipped: o.nSkipped,
			},
		}
		res, err = json.MarshalIndent(jsonObj, "", "  ")
	} else {
		jsonObj := struct {
			Resources []oresult `json:"resources"`
		}{
			Resources: o.results,
		}
		res, err = json.MarshalIndent(jsonObj, "", "  ")
	}
	if err != nil {
		return err
	}
	fmt.Fprintf(o.w, "%s\n", res)
	return nil
}
func ( o * jsono ) Flush ( ) error { var err error var res [ ] byte if o . withSummary { jsonObj := struct { Resources [ ] oresult `json:"resources"` Summary struct { Valid int `json:"valid"` Invalid int `json:"invalid"` Errors int `json:"errors"` Skipped int `json:"skipped"` } `json:"summary"` } { Resources : o . results , Summary : struct { Valid int `json:"valid"` Invalid int `json:"invalid"` Errors int `json:"errors"` Skipped int `json:"skipped"` } { Valid : o . nValid , Invalid : o . nInvalid , Errors : o . nErrors , Skipped : o . nSkipped , } , } res , err = json . MarshalIndent ( jsonObj , " " , " " ) } else { jsonObj := struct { Resources [ ] oresult `json:"resources"` } { Resources : o . results , } res , err = json . MarshalIndent ( jsonObj , " " , " " ) } if err != nil { return err } fmt . Fprintf ( o . w , " \n " , res ) return nil }
Flush outputs the results as JSON
Flush outputs the results as JSON