Чтение файла JSON в сценарии оболочки - PullRequest
0 голосов
/ 11 мая 2019

У меня есть файл JSON, как показано ниже:

{"nodes":{"10.174.131.57":{"type":"Master","agent":"UP","db":"UP","vip":"","vip_active":false,"xlog":"D\/A3000D40","xloginfo":""},"10.174.131.58":{"type":"Idle","agent":"UP","db":"UNKNOWN","vip":"","vip_active":false,"xlog":"UNKNOWN","xloginfo":"Connection to 10.174.131.58:5444 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP\/IP connections."},"10.174.131.59":{"type":"Standby","agent":"UP","db":"UP","vip":"","vip_active":false,"xlog":"D\/A3000D40","xloginfo":""}},"allowednodes":["10.174.131.57","10.174.131.58","10.174.131.59"],"membershipcoordinator":"10.174.131.57","failoverpriority":["10.174.131.59"],"minimumstandbys":0,"missingnodes":[],"messages":[]}

Я хочу сохранить каждый из компонентов узлов в переменных, а затем сравнить их по несоответствиям: например:

{"nodes":{"10.174.131.57":{"type":"Master","agent":"UP","db":"UP" ==> for this node, all these data should get stored on a set of variables.
"10.174.131.58":{"type":"Idle","agent":"UP","db":"UNKNOWN","vip":"","vip_active":false,"xlog":
==> this will get stored on a another set of variables.. and so on, and  then I'll compare if they are equal or not.

Или, если кто-то может дать очень простую процедуру, чтобы сделать этот файл понятным с помощью сценария оболочки, это будет полезно.

...