JsonConverter.cpp
Go to the documentation of this file.
1
#include "
JsonConverter.h
"
2
3
#include <
RobotAPI/libraries/aron/converter/json/NLohmannJSONConverter.h
>
4
5
namespace
armarx::armem::server::ltm::processor::converter::type::object
6
{
7
std::pair<std::vector<unsigned char>, std::string>
8
JsonConverter::convert
(
const
aron::type::ObjectPtr
&
data
)
9
{
10
nlohmann::json j =
11
aron::type::converter::AronNlohmannJSONConverter::ConvertToNlohmannJSON
(
data
);
12
auto
str
= j.dump(2);
13
return
std::make_pair(std::vector<unsigned char>(
str
.begin(),
str
.end()),
""
);
14
}
15
16
aron::type::ObjectPtr
17
JsonConverter::convert
(
const
std::vector<unsigned char>&
data
,
const
std::string&)
18
{
19
std::string
str
(
data
.begin(),
data
.end());
20
nlohmann::json j = nlohmann::json::parse(
str
);
21
return
aron::type::converter::AronNlohmannJSONConverter::ConvertFromNlohmannJSONTypeObject
(
22
j);
23
}
24
}
// namespace armarx::armem::server::ltm::processor::converter::type::object
str
std::string str(const T &t)
Definition:
UserAssistedSegmenterGuiWidgetController.cpp:42
JsonConverter.h
NLohmannJSONConverter.h
armarx::aron::type::converter::AronNlohmannJSONConverter::ConvertFromNlohmannJSONTypeObject
static type::ObjectPtr ConvertFromNlohmannJSONTypeObject(const nlohmann::json &j, const armarx::aron::Path &p={})
Definition:
NLohmannJSONConverter.cpp:66
data
uint8_t data[1]
Definition:
EtherCATFrame.h:68
armarx::armem::server::ltm::processor::converter::type::object
Definition:
JsonConverter.cpp:5
armarx::armem::server::ltm::processor::converter::type::object::JsonConverter::convert
std::pair< std::vector< unsigned char >, std::string > convert(const aron::type::ObjectPtr &data) final
Definition:
JsonConverter.cpp:8
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition:
Object.h:36
armarx::aron::type::converter::AronNlohmannJSONConverter::ConvertToNlohmannJSON
static nlohmann::json ConvertToNlohmannJSON(const type::VariantPtr &)
Definition:
NLohmannJSONConverter.cpp:51
RobotAPI
libraries
armem
server
ltm
processors
converter
type
object
json
JsonConverter.cpp
Generated on Sat Oct 12 2024 09:14:08 for armarx_documentation by
1.8.17