<commit_before>package gojsonexplode

// TODO: cannot have delimiter be " or \

import (
	"encoding/json"
	"errors"
	"strconv"
)

func explodeList(l []interface{}, parent string, delimiter string) (map[string]interface{}, error) {
	var err error
	var key string
	j := make(map[string]interface{})
	for k, i := range l {
		if len(parent) > 0 {
			key = parent + delimiter + strconv.Itoa(k)
		} else {
			key = strconv.Itoa(k)
		}
		switch v := i.(type) {
		case nil:
			j[key] = v
		case int:
			j[key] = v
		case float64:
			j[key] = v
		case string:
			j[key] = v
		case bool:
			j[key] = v<commit_msg>Modified code so that if there is an empty array it will stil return the key with a null value, whereas before it excluded the key altogether.<commit_after>package gojsonexplode

// TODO: cannot have delimiter be " or \

import (
	"encoding/json"
	"errors"
	"strconv"
)

func explodeList(l []interface{}, parent string, delimiter string) (map[string]interface{}, error) {
	var err error
	var key string
	j := make(map[string]interface{})
	if len(l) == 0 {
		key = parent
		j[key] = nil
	}
	for k, i := range l {
		if len(parent) > 0 {
			key = parent + delimiter + strconv.Itoa(k)
		} else {
			key = strconv.Itoa(k)
		}
		switch v := i.(type) {
		case nil:
			j[key] = v
		case int:
			j[key] = v
		case float64:
			j[key] = v
		case string:
			j[key] = v
		case bool:
			j[key] = v
{'fraction_non_alphanumeric': 0.13564213564213565, 'fraction_numerical': 0.005050505050505051, 'mean_word_length': 3.0794117647058825, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1406919', 'n_tokens_mistral': 580, 'n_tokens_neox': 526, 'n_words': 168}