@edit Below is the JSON getting saved as $content
[
{
"date_created": 1234,
"fingerprint_hash": null,
"address": "xx:xx:xx:xx:xx:xx",
"name": null,
"manufacturer": "xxx",
"date_updated": 1234,
"active": true,
"date_last_active": 1234,
"mac_group_info": {
"name": null,
"id": 0,
"remarks": null
},
"id": 1234,
"remarks": null,
"arp_mapping_info": [
{
"ip_info": {
"date_changed": 1234,
"date_last_kerberos_login": null,
"dns_name": "xxxx",
"id": 6,
"remarks": null,
"date_created": 1234,
"kerberos_user_name": null,
"ip_group_info": {
"remarks": null,
"id": 0,
"name": null
},
"address": "x.x.x.x"
},
"interface_info": [
{
"link": "on",
"name": "x",
"discovery_info": null,
"speed": 1234,
"host_info": {
"backup_sensor_id": 0,
"type": "xxxx",
"radius_coa_flags": null,
"moment": 1,
"name": null,
"host_group_info": {
"name": null,
"id": 0,
"remarks": null
},
"interface_mib": "D",
"uplink_count": 1,
"sensor_info": {
"id": 1,
"os_version": "xxxx",
"architecture": "xxxx",
"remarks": null,
"last_contact": "xxxx",
"queue": 0,
"address": "x.x.xx",
"status": "active",
"os_name": "linux",
"name": "xxxx",
"version": "x.x.x-x"
},
"mode": "xx",
"address": "x.x.x.x",
"radius_secret": null,
"arp_mib": "2",
"cam_count": 1,
"discovery2_mib": "C",
"discovery1_mib": "3",
"radius_coa_port": null,
"radius_requests_count": 0,
"vlan_count": 1,
"access_to_port": 1,
"vlan_mib": "C",
"interval": 1,
"snmp_traps_community": null,
"engine_mode": "dynamic",
"manufacturer": "ciscoSystems",
"engine_id": null,
"snmp_traps_version": "1",
"mib_options": null,
"remarks": null,
"snmp_write_version": "2c",
"snmp_write_community": "private",
"access_to_cam": 1,
"status": "ok",
"access_to_cto": 1,
"access_to_interface": 1,
"snmp_read_version": "1",
"snmp_read_community": "public",
"id": 1,
"cam_mib": "C",
"arp_count": 1,
"access_to_arp": 1,
"port_count": 1,
"main_sensor_id": 1
},
"status": "on",
"index": 1,
"protocols": [
"ARP",
"NDP"
],
"id": 1,
"remarks": null,
"sniffer_mode": null
}
],
"host_id": 1
}
],
"cam_mapping_info": []
}
]
Thats my code:
foreach ($content){
$content =~ s/\[/\[\n\t/g;
$content =~ s/{/{\n\t/g;
$content =~ s/\]/\n\]/g;
$content =~ s/}/}\n/g;
$content =~ s/,/\n\t/g;
print $content;
}
Todo: get the same output as the JSON above but with a perl skript runing it withouth any modules, normaly we use postman for it. As I asked my "couch" for help he only said: just learn to programm. Yeah...
The output I get with my regex is almost the solution. It just stops tabing after the first tab, doent repeat it on another opening bracket.