blob: 2c08e98ac57766a09703e2289ba2538b302425cc [file] [log] [blame]
David Valleau4822bac2018-12-12 10:33:51 -08001// Copyright 2018 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Fletcher Woodruff6cdda0a2020-04-22 11:14:07 -06005#ifndef VALUE_UTIL_H__
6#define VALUE_UTIL_H__
David Valleau4822bac2018-12-12 10:33:51 -08007
Fletcher Woodruff76e9e782020-04-30 16:51:26 -06008#include <memory>
9#include <string>
10
David Valleau4822bac2018-12-12 10:33:51 -080011#include <base/json/json_reader.h>
12#include <base/optional.h>
13#include <base/values.h>
14
David Valleau4822bac2018-12-12 10:33:51 -080015// Attempt to load the contents of the JSON file located at |file_path| and
16// return the contents in a string.
17base::Optional<std::string> GetJSONContents(const std::string& file_path);
18
19// Use a JSONReader to parse |json_contents| and return a pointer to the
20// underlying Value object.
hscham0ba28972020-11-09 11:19:02 +090021base::Optional<base::Value> GetJSONValue(const std::string& json_contents);
David Valleau4822bac2018-12-12 10:33:51 -080022
Fletcher Woodruff6cdda0a2020-04-22 11:14:07 -060023#endif // VALUE_UTIL_H__